mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-25 08:37:29 +01:00
Mention tokio-stream in SSE example
This commit is contained in:
parent
cc611b8b24
commit
e8cf5f4f0e
1 changed files with 3 additions and 0 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue