Struct ws::Handshake [] [src]

pub struct Handshake {
    pub request: Request,
    pub response: Response,
    pub peer_addr: Option<SocketAddr>,
    pub local_addr: Option<SocketAddr>,
}

A struct representing the two halves of the WebSocket handshake.

Fields

The HTTP request sent to begin the handshake.

The HTTP response from the server confirming the handshake.

The socket address of the other endpoint. This address may be an intermediary such as a proxy server.

The socket address of this endpoint.

Methods

impl Handshake
[src]

[src]

Get the IP address of the remote connection.

This is the preferred method of obtaining the client's IP address. It will attempt to retrieve the most likely IP address based on request headers, falling back to the address of the peer.

Note

This assumes that the peer is a client. If you are implementing a WebSocket client and want to obtain the address of the server, use Handshake::peer_addr instead.

This method does not ensure that the address is a valid IP address.

Trait Implementations

impl Debug for Handshake
[src]

[src]

Formats the value using the given formatter. Read more