pub struct WsClient { /* private fields */ }Expand description
Manages a WebSocket connection lifecycle.
Wraps a WebSocketStream and provides connect/disconnect with
proper WebSocket Close frame semantics.
Implementations§
Source§impl WsClient
impl WsClient
Sourcepub fn new(stream: WebSocketStream<MaybeTlsStream<TcpStream>>) -> Self
pub fn new(stream: WebSocketStream<MaybeTlsStream<TcpStream>>) -> Self
Create a new WsClient from an already-established WebSocketStream.
Sourcepub fn stream(&mut self) -> &mut WebSocketStream<MaybeTlsStream<TcpStream>>
pub fn stream(&mut self) -> &mut WebSocketStream<MaybeTlsStream<TcpStream>>
Get a mutable reference to the underlying stream.
Sourcepub async fn disconnect(&mut self) -> Result<(), LimitlessError>
pub async fn disconnect(&mut self) -> Result<(), LimitlessError>
Send a WebSocket Close frame and consume the connection.
Auto Trait Implementations§
impl !Freeze for WsClient
impl !RefUnwindSafe for WsClient
impl Send for WsClient
impl Sync for WsClient
impl Unpin for WsClient
impl UnsafeUnpin for WsClient
impl !UnwindSafe for WsClient
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