pub struct WebSocketWrite<IO> { /* private fields */ }Expand description
The write half of a split WebSocket.
This half can send messages but cannot receive. Use the read half’s
reunite() to recombine.
Implementations§
Source§impl<IO> WebSocketWrite<IO>
impl<IO> WebSocketWrite<IO>
Sourcepub async fn send(&mut self, cx: &Cx, msg: Message) -> Result<(), WsError>
pub async fn send(&mut self, cx: &Cx, msg: Message) -> Result<(), WsError>
Send a message.
§Cancel-Safety
If cancelled, the message may be partially sent. The connection should be closed if cancellation occurs mid-send.
Sourcepub async fn close(&mut self, reason: CloseReason) -> Result<(), WsError>
pub async fn close(&mut self, reason: CloseReason) -> Result<(), WsError>
Initiate a close handshake.
Sends a close frame. The read half will receive the peer’s response.
Sourcepub async fn ping(&mut self, payload: impl Into<Bytes>) -> Result<(), WsError>
pub async fn ping(&mut self, payload: impl Into<Bytes>) -> Result<(), WsError>
Send a ping frame.
Sourcepub fn close_state(&self) -> CloseState
pub fn close_state(&self) -> CloseState
Get the close state.
Auto Trait Implementations§
impl<IO> Freeze for WebSocketWrite<IO>
impl<IO> !RefUnwindSafe for WebSocketWrite<IO>
impl<IO> Send for WebSocketWrite<IO>where
IO: Send,
impl<IO> Sync for WebSocketWrite<IO>where
IO: Send,
impl<IO> Unpin for WebSocketWrite<IO>
impl<IO> UnsafeUnpin for WebSocketWrite<IO>
impl<IO> !UnwindSafe for WebSocketWrite<IO>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).