Struct websocket::client::request::Request
[−]
[src]
pub struct Request<R: Read, W: Write> { pub version: HttpVersion, pub headers: Headers, // some fields omitted }
Represents a WebSocket request.
Note that nothing is written to the internal Writer until the send()
method is called.
Fields
version | The HTTP version of this request. |
headers | The headers of this request. |
Methods
impl<R: Read, W: Write> Request<R, W>
fn new<T: ToWebSocketUrlComponents>(components: T, reader: R, writer: W) -> WebSocketResult<Request<R, W>>
Creates a new client-side request.
In general Client::connect()
should be used for connecting to servers.
However, if the request is to be written to a different Writer, this function
may be used.
fn key(&self) -> Option<&WebSocketKey>
Short-cut to obtain the WebSocketKey value.
fn version(&self) -> Option<&WebSocketVersion>
Short-cut to obtain the WebSocketVersion 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 origin(&self) -> Option<&Origin>
Short-cut to obtain the Origin value.
fn key_mut(&mut self) -> Option<&mut WebSocketKey>
Short-cut to obtain a mutable reference to the WebSocketKey value.
Note that to add a header that does not already exist, Request.headers.set()
must be used.
fn version_mut(&mut self) -> Option<&mut WebSocketVersion>
Short-cut to obtain a mutable reference to the WebSocketVersion value.
Note that to add a header that does not already exist, Request.headers.set()
must be used.
fn protocol_mut(&mut self) -> Option<&mut WebSocketProtocol>
Short-cut to obtaina mutable reference to the WebSocketProtocol value.
Note that to add a header that does not already exist, Request.headers.set()
must be used.
fn extensions_mut(&mut self) -> Option<&mut WebSocketExtensions>
Short-cut to obtain a mutable reference to the WebSocketExtensions value.
Note that to add a header that does not already exist, Request.headers.set()
must be used.
fn origin_mut(&mut self) -> Option<&mut Origin>
Short-cut to obtain a mutable reference to the Origin value.
Note that to add a header that does not already exist, Request.headers.set()
must be used.
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 into_inner(self) -> (BufReader<R>, W)
Return the inner Reader and Writer.
fn send(self) -> WebSocketResult<Response<R, W>>
Sends the request to the server and returns a response.