Expand description
Pure-Rust W3C WebSocket Client with RFC 6455 Frame Serialization, Handshake & TLS (wss://).
Provides:
- Complete RFC 6455 frame encoding and decoding with masking and control frame processing.
- Cryptographic
Sec-WebSocket-Keygeneration and SHA-1Sec-WebSocket-Acceptvalidation. - Native TLS transport for
wss://connections via Mozilla WebPKI root certificates andrustls. - Asynchronous background worker stream reading, heartbeat Ping/Pong processing, and queueing.
Structs§
- WebSocket
- W3C WebSocket client interface supporting
ws://and TLSwss://. - WsFragment
- Ongoing fragmented message tracking state.
- WsFrame
- A decoded RFC 6455 WebSocket frame.
Enums§
- WsError
- Errors occurring during WebSocket communication.
- WsMessage
- High-level WebSocket message.
- WsOpcode
- RFC 6455 WebSocket Opcode.
- WsState
- State of the WebSocket connection per W3C specification.
Constants§
- DEFAULT_
MAX_ FRAME_ SIZE - Maximum default frame payload size before automatically fragmenting (64 KB).
Functions§
- base64_
encode - Standard base64 encoding.
- compute_
sec_ websocket_ accept - Computes the expected RFC 6455
Sec-WebSocket-Acceptheader value from client key. - decode_
frame - Decodes an RFC 6455 frame from a byte buffer.
- encode_
frame - Encodes an RFC 6455 frame into bytes.
- generate_
mask_ key - Generates an unpredictable 32-bit masking key for client frames (RFC 6455 §5.3).
- generate_
sec_ websocket_ key - Generates a cryptographically random 16-byte base64 nonce for
Sec-WebSocket-Key(RFC 6455 §4.1). - sha1
- Computes FIPS 180-1 SHA-1 digest in pure Rust.