pub struct WebSocketConnection { /* private fields */ }Expand description
An active WebSocket connection.
Use next() to receive events, or convert to a Stream for async iteration.
Implementations§
Source§impl WebSocketConnection
impl WebSocketConnection
Sourcepub async fn next(&mut self) -> Option<Result<WebSocketEvent>>
pub async fn next(&mut self) -> Option<Result<WebSocketEvent>>
Receive the next WebSocket event.
Returns None if the connection is closed.
Sourcepub fn time_since_last_ping(&self) -> Duration
pub fn time_since_last_ping(&self) -> Duration
Get the time since the last ping was received.
Sourcepub fn into_stream(self) -> WebSocketEventStream
pub fn into_stream(self) -> WebSocketEventStream
Convert this connection into a Stream of events.
Auto Trait Implementations§
impl !Freeze for WebSocketConnection
impl !RefUnwindSafe for WebSocketConnection
impl Send for WebSocketConnection
impl Sync for WebSocketConnection
impl Unpin for WebSocketConnection
impl !UnwindSafe for WebSocketConnection
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