pub struct SseStream { /* private fields */ }Expand description
Options for a streaming SSE response; Sse::stream uses the defaults.
use std::time::Duration;
use rust_web_server::sse::SseStream;
let (events, response) = SseStream::new().buffer(256).keep_alive(Duration::from_secs(5)).start();Implementations§
Source§impl SseStream
impl SseStream
Sourcepub fn buffer(self, events: usize) -> Self
pub fn buffer(self, events: usize) -> Self
How many events may wait for a slow client before
SseSender::send blocks (and SseSender::try_send drops).
Sourcepub fn keep_alive(self, interval: Duration) -> Self
pub fn keep_alive(self, interval: Duration) -> Self
After this long with nothing sent, a : keep-alive comment goes out:
proxies keep the connection, and a client that left is noticed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SseStream
impl RefUnwindSafe for SseStream
impl Send for SseStream
impl Sync for SseStream
impl Unpin for SseStream
impl UnsafeUnpin for SseStream
impl UnwindSafe for SseStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more