pub struct WebSocket { /* private fields */ }Expand description
An established WebSocket connection. Obtained inside the
WebSocketUpgrade::on_upgrade callback.
Implementations§
Source§impl WebSocket
impl WebSocket
Sourcepub async fn recv(&mut self) -> Option<Result<Message>>
pub async fn recv(&mut self) -> Option<Result<Message>>
Receive the next message. None when the connection has closed.
Sourcepub async fn send_text(&mut self, text: impl Into<String>) -> Result<()>
pub async fn send_text(&mut self, text: impl Into<String>) -> Result<()>
Convenience: send a text message.
Auto Trait Implementations§
impl !Freeze for WebSocket
impl !RefUnwindSafe for WebSocket
impl !Sync for WebSocket
impl !UnwindSafe for WebSocket
impl Send for WebSocket
impl Unpin for WebSocket
impl UnsafeUnpin for WebSocket
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