pub struct Connection { /* private fields */ }Expand description
Manages WebSocket connection
Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn send(&self, message: ClientMessage) -> Result<()>
pub async fn send(&self, message: ClientMessage) -> Result<()>
Send a message to the server
Sourcepub async fn recv(&self) -> Result<Option<ServerMessage>>
pub async fn recv(&self) -> Result<Option<ServerMessage>>
Receive a message from the server
Sourcepub async fn state(&self) -> ConnectionState
pub async fn state(&self) -> ConnectionState
Get current connection state
Sourcepub async fn set_state(&self, state: ConnectionState)
pub async fn set_state(&self, state: ConnectionState)
Set connection state
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if connected
Auto Trait Implementations§
impl Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl !UnwindSafe for Connection
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