Function actix_web_lab::sse::channel
source ยท pub fn channel(buffer: usize) -> (Sender, Sse<ChannelStream>)
Expand description
Create server-sent events (SSE) channel pair.
The buffer
argument controls how many unsent messages can be stored without waiting.
The first item in the tuple is the sender half. Much like a regular channel, it can be cloned, sent to another thread/task, and send event messages to the response stream. It provides several methods that represent the event-stream format.
The second item is the responder and can, therefore, be used as a handler return type directly. The stream will be closed after all senders are dropped.
Read more about server-sent events in this MDN article.
See module docs for usage example.