mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 20:53:06 +00:00
fix hot reloading in router example
This commit is contained in:
parent
064bee4a9f
commit
3c002913eb
2 changed files with 5 additions and 7 deletions
|
@ -50,6 +50,8 @@ fn main() {
|
|||
axum::Router::new()
|
||||
// Register server functions
|
||||
.register_server_fns("")
|
||||
// Connect to the hot reload server
|
||||
.connect_hot_reload()
|
||||
// Serve the static assets folder
|
||||
.nest_service("/assets", serve_dir)
|
||||
// If the path is unknown, render the application
|
||||
|
|
|
@ -290,15 +290,10 @@ where
|
|||
self.nest(
|
||||
"/_dioxus",
|
||||
Router::new()
|
||||
.route("/hot_reload", get(hot_reload_handler))
|
||||
.route(
|
||||
"/disconnect",
|
||||
get(|ws: WebSocketUpgrade| async {
|
||||
ws.on_failed_upgrade(|error| {
|
||||
println!("failed to upgrade: {}", error);
|
||||
todo!()
|
||||
})
|
||||
.on_upgrade(|mut ws| async move {
|
||||
ws.on_upgrade(|mut ws| async move {
|
||||
use axum::extract::ws::Message;
|
||||
let _ = ws.send(Message::Text("connected".into())).await;
|
||||
loop {
|
||||
|
@ -308,7 +303,8 @@ where
|
|||
}
|
||||
})
|
||||
}),
|
||||
),
|
||||
)
|
||||
.route("/hot_reload", get(hot_reload_handler)),
|
||||
)
|
||||
}
|
||||
#[cfg(not(all(debug_assertions, feature = "hot-reload", feature = "ssr")))]
|
||||
|
|
Loading…
Reference in a new issue