Expand description
WebSocket protocol support.
Use handshake() or handshake_response() to perform a server-side
opening handshake, and WsClient to establish a client connection.
Framed communication uses Codec to encode and decode Frames and
Messages. On the client side, WsConnection::start() runs a frame
handling service, WsConnection::receiver() returns a stream of frames,
and WsConnection::sink() returns a WsSink for sending messages.
WsTransport is a byte-stream filter instead: binary and continuation
frames are exposed as raw bytes, text frames are rejected, and control
frames are handled internally. Use WsConnection::into_transport() to
run a byte-oriented protocol over a WebSocket connection.
Modules§
- error
- WebSocket protocol related errors.
Structs§
- Close
Reason - Reason supplied in a WebSocket close control frame.
- Codec
- Encoder and decoder for WebSocket frames.
- Parser
- WebSocket frame parser.
- WsClient
- Builder for establishing a WebSocket client connection.
- WsClient
Config - Configuration for a WebSocket client connection.
- WsConnection
- An established WebSocket client connection.
- WsSink
- A clonable handle for sending messages over a WebSocket connection.
- WsTransport
- I/O filter that exposes binary WebSocket messages as a byte stream.
- WsTransport
Service - Service that adds a
WsTransportfilter to an I/O stream.
Enums§
- Close
Code - Status code used to indicate why an endpoint is closing the
WebSocketconnection. - Frame
- A decoded WebSocket frame.
- Item
- A fragment in a WebSocket continuation sequence.
- Message
- An outgoing WebSocket message.
- OpCode
- WebSocket frame operation codes defined by RFC 6455.
Functions§
- handshake
- Verifies a WebSocket opening-handshake request and creates its response.
- handshake_
response - Creates a WebSocket opening-handshake response.
- hash_
key - Computes the
Sec-WebSocket-Acceptvalue for a client handshake key. - verify_
handshake - Verifies a WebSocket opening-handshake request.