Mention tokio-stream in SSE example

This commit is contained in:
David Pedersen 2023-08-06 20:43:24 +02:00
parent cc611b8b24
commit e8cf5f4f0e

View file

@ -50,6 +50,9 @@ async fn sse_handler(
println!("`{}` connected", user_agent.as_str());
// 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!"))
.map(Ok)
.throttle(Duration::from_secs(1));