pub struct Sse<S> { /* private fields */ }
Available on crate feature
tokio
only.Expand description
An SSE response
Implementations§
source§impl<S> Sse<S>
impl<S> Sse<S>
sourcepub fn new(stream: S) -> Selfwhere
S: TryStream<Ok = Event> + Send + 'static,
S::Error: Into<BoxError>,
pub fn new(stream: S) -> Selfwhere S: TryStream<Ok = Event> + Send + 'static, S::Error: Into<BoxError>,
Create a new Sse
response that will respond with the given stream of
Event
s.
See the module docs for more details.
sourcepub fn keep_alive(self, keep_alive: KeepAlive) -> Self
pub fn keep_alive(self, keep_alive: KeepAlive) -> Self
Configure the interval between keep-alive messages.
Defaults to no keep-alive messages.