I am trying to following the exaple and have something like
// Handler to upgrade the connection and pass the unique_id
#[cfg(feature = "ssr")]
pub async fn websocket(
axum::extract::Path(unique_id): axum::extract::Path<String>,
ws: axum::extract::WebSocketUpgrade,
) -> axum::response::Response {
ws.on_upgrade(move |socket| handle_socket(socket, unique_id))
}
// Function to handle the socket and use the unique_id
#[cfg(feature = "ssr")]
async fn handle_socket(mut socket: axum::extract::ws::WebSocket, unique_id: String) {
use api::PointValue;
use leptos_server_signal::ServerSignal;
let mut point_value = ServerSignal::<PointValue>::new("point_value").unwrap();
loop {
tokio::time::sleep(std::time::Duration::from_millis(5000)).await;
log::info!("unique_id: {:?}", unique_id);
let result = point_value.with(&mut socket, |point_value| {
point_value.value += 1.0;
}).await;
if result.is_err() {
break;
}
}
// Use the unique_id as needed
println!("Handling socket for unique_id: {}", unique_id);
}
in debug mode i see this warning every 5 seconds
redwood.js:1528 [Signal::update] At Location { file: "/home/glenn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos_server_signal-0.6.0/src/lib.rs", line: 207, col: 32 }, you’re trying to update a Signal<serde_json::value::Value> (defined at /home/glenn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos_server_signal-0.6.0/src/lib.rs:124:26) that has already been disposed of. This is probably a logic error in a component that creates and disposes of scopes. If it does not cause any issues, it is safe to ignore this warning, which occurs only in debug mode.
redwood.js:1528 Attempted to update a signal after it was disposed.
signal created here: /home/glenn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos_server_signal-0.6.0/src/lib.rs:124:26
warning happened here: /home/glenn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos_server_signal-0.6.0/src/lib.rs:207:32
my component has
// Provide websocket connection
leptos_server_signal::provide_websocket("ws://192.168.22.8:5000/ws/fecd6820-47e1-4072-a5b1-3c383d9cb615").unwrap();
// Create server signal
let point_value = create_server_signal::<PointValue>("point_value");
view! {
<Card title="Electricity Now">
<h1>"Point Value: " {move || point_value.get().value.to_string()}</h1>
...
I am trying to following the exaple and have something like
in debug mode i see this warning every 5 seconds
my component has
Is there someway to prevent this warning ?
I am using leptos 0.6.5
Thanks