Struct websocket::client::response::Response [] [src]

pub struct Response<R: Read, W: Write> {
    pub status: StatusCode,
    pub headers: Headers,
    pub version: HttpVersion,
    // some fields omitted
}

Represents a WebSocket response.

Fields

status

The status of the response

headers

The headers contained in this response

version

The HTTP version of this response

Methods

impl<R: Read, W: Write> Response<R, W>

fn read(request: Request<R, W>) -> WebSocketResult<Response<R, W>>

Reads a Response off the stream associated with a Request.

This is called by Request.send(), and does not need to be called by the user.

fn accept(&self) -> Option<&WebSocketAccept>

Short-cut to obtain the WebSocketAccept value.

fn protocol(&self) -> Option<&WebSocketProtocol>

Short-cut to obtain the WebSocketProtocol value.

fn extensions(&self) -> Option<&WebSocketExtensions>

Short-cut to obtain the WebSocketExtensions value.

fn get_reader(&self) -> &BufReader<R>

Returns a reference to the inner Reader.

fn get_writer(&self) -> &W

Returns a reference to the inner Writer.

fn get_mut_reader(&mut self) -> &mut BufReader<R>

Returns a mutable reference to the inner Reader.

fn get_mut_writer(&mut self) -> &mut W

Returns a mutable reference to the inner Writer.

fn get_request(&self) -> &Request<R, W>

Returns a reference to the request associated with this response.

fn into_inner(self) -> (BufReader<R>, W)

Return the inner Reader and Writer.

fn validate(&self) -> WebSocketResult<()>

Check if this response constitutes a successful handshake.

fn begin_with<D, B, C>(self, sender: B, receiver: C) -> Client<D, B, C> where B: Sender, C: Receiver<D>, D: DataFrameable

Consume this response and return a Client ready to transmit/receive data frames using the data frame type D, Sender B and Receiver C.

Does not check if the response was valid. Use validate() to ensure that the response constitutes a successful handshake.

fn begin(self) -> Client<DataFrame, Sender<W>, Receiver<R>>

Consume this response and return a Client ready to transmit/receive data frames.

Does not check if the response was valid. Use validate() to ensure that the response constitutes a successful handshake.

Trait Implementations

impl<R, W> Send for Response<R, W> where R: Read + Send, W: Write + Send