Struct tungstenite::protocol::WebSocket[][src]

pub struct WebSocket<Stream> { /* fields omitted */ }

WebSocket input-output stream.

This is THE structure you want to create to be able to speak the WebSocket protocol. It may be created by calling connect, accept or client functions.

Methods

impl<Stream> WebSocket<Stream>
[src]

Convert a raw socket into a WebSocket without performing a handshake.

Convert a raw socket into a WebSocket without performing a handshake.

Important traits for &'a mut R

Returns a shared reference to the inner stream.

Important traits for &'a mut R

Returns a mutable reference to the inner stream.

impl<Stream: Read + Write> WebSocket<Stream>
[src]

Read a message from stream, if possible.

This function sends pong and close responses automatically. However, it never blocks on write.

Send a message to stream, if possible.

This function guarantees that the frame is queued regardless of any errors. There is no need to resend the frame. In order to handle WouldBlock or Incomplete, call write_pending() afterwards.

Note that only the last pong frame is stored to be sent, and only the most recent pong frame is sent if multiple pong frames are queued up.

Close the connection.

This function guarantees that the close frame will be queued. There is no need to call it again, just like write_message().

Flush the pending send queue.

Auto Trait Implementations

impl<Stream> Send for WebSocket<Stream> where
    Stream: Send

impl<Stream> Sync for WebSocket<Stream> where
    Stream: Sync