mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Mention tokio-stream in SSE example
This commit is contained in:
@@ -50,6 +50,9 @@ async fn sse_handler(
|
|||||||
println!("`{}` connected", user_agent.as_str());
|
println!("`{}` connected", user_agent.as_str());
|
||||||
|
|
||||||
// A `Stream` that repeats an event every second
|
// A `Stream` that repeats an event every second
|
||||||
|
//
|
||||||
|
// You can also create streams from tokio channels using the wrappers in
|
||||||
|
// https://docs.rs/tokio-stream
|
||||||
let stream = stream::repeat_with(|| Event::default().data("hi!"))
|
let stream = stream::repeat_with(|| Event::default().data("hi!"))
|
||||||
.map(Ok)
|
.map(Ok)
|
||||||
.throttle(Duration::from_secs(1));
|
.throttle(Duration::from_secs(1));
|
||||||
|
|||||||
Reference in New Issue
Block a user