Struct evzht9h3nznqzwl::server::upgrade::WsUpgrade [] [src]

pub struct WsUpgrade<S, B> where
    S: Stream
{ pub headers: Headers, pub stream: S, pub request: Request, pub buffer: B, }

Intermediate representation of a half created websocket session. Should be used to examine the client's handshake accept the protocols requested, route the path, etc.

Users should then call accept or reject to complete the handshake and start a session. Note: if the stream in use is AsyncRead + AsyncWrite, then asynchronous functions will be available when completing the handshake. Otherwise if the stream is simply Read + Write blocking functions will be available to complete the handshake.

Fields

The headers that will be used in the handshake response.

The stream that will be used to read from / write to.

The handshake request, filled with useful metadata.

Some buffered data from the stream, if it exists.

Methods

impl<S> WsUpgrade<S, Option<Buffer>> where
    S: Stream
[src]

These methods are the synchronous ways of accepting and rejecting a websocket handshake.

[src]

Accept the handshake request and send a response, if nothing goes wrong a client will be created.

[src]

Accept the handshake request and send a response while adding on a few headers. These headers are added before the required headers are, so some might be overwritten.

[src]

Reject the client's request to make a websocket connection.

[src]

Reject the client's request to make a websocket connection and send extra headers.

impl<S, B> WsUpgrade<S, B> where
    S: Stream + AsTcpStream
[src]

[src]

Get a handle to the underlying TCP stream, useful to be able to set TCP options, etc.

impl<S, B> WsUpgrade<S, B> where
    S: Stream
[src]

[src]

Select a protocol to use in the handshake response.

[src]

Select an extension to use in the handshake response.

[src]

Select multiple extensions to use in the connection

[src]

Drop the connection without saying anything.

[src]

A list of protocols requested from the client.

[src]

A list of extensions requested from the client.

[src]

The client's websocket accept key.

[src]

The client's websocket version.

[src]

Origin of the client