pub struct WebSocketConnection { /* private fields */ }Expand description
WebSocket connection wrapper
Implementations§
Source§impl WebSocketConnection
impl WebSocketConnection
Sourcepub async fn connect(&mut self) -> Result<(), WebSocketError>
pub async fn connect(&mut self) -> Result<(), WebSocketError>
Connect to the WebSocket server
Sourcepub async fn disconnect(&mut self) -> Result<(), WebSocketError>
pub async fn disconnect(&mut self) -> Result<(), WebSocketError>
Disconnect from the WebSocket server
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected
Sourcepub async fn receive(&mut self) -> Result<String, WebSocketError>
pub async fn receive(&mut self) -> Result<String, WebSocketError>
Receive a message
Trait Implementations§
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