diff --git a/examples/fullstack-streaming/src/main.rs b/examples/fullstack-streaming/src/main.rs index ac3bb7e9a..041ff2228 100644 --- a/examples/fullstack-streaming/src/main.rs +++ b/examples/fullstack-streaming/src/main.rs @@ -30,7 +30,10 @@ pub async fn test_stream() -> Result { loop { tokio::time::sleep(tokio::time::Duration::from_millis(500)).await; dioxus::logger::tracing::info!("Sending new chunk!"); - let _ = tx.unbounded_send(Ok("Hello, world!".to_string())); + if tx.unbounded_send(Ok("Hello, world!".to_string())).is_err() { + // If the channel is closed, stop sending chunks + break; + } } });