Expand description
RFC 7692 permessage-deflate: negotiation and per-message codec.
Memory policy, chosen for tens of thousands of mostly idle connections:
- Server → client: the server always declares
server_no_context_takeover(allowed by RFC 7692 §7.1.1.1 regardless of the offer). Compression state is then not needed between messages, so compressors come from a process-wide pool instead of being held per connection. - Client → server: a decompressor is allocated lazily, on the first
compressed message. With
client_no_context_takeover(requested by the client, or imposed by configuration per §7.1.1.2) it is reset after every message. server_max_window_bits< 15 cannot be honoured by the pure-Rust DEFLATE backend, so such offers are declined (the connection then simply runs uncompressed, which RFC 7692 and OCPP both allow).
Structs§
- Deflate
Config - Deflate
Params - Parameters agreed during the handshake.
- Inflater
- Per-connection decompressor for messages received from the peer.
Enums§
Functions§
- accept_
client_ response - Client side: interprets the server’s
Sec-WebSocket-Extensionsresponse. - compress_
message - Compresses one message without context takeover, using a pooled compressor.
- negotiate_
server - Server side: picks the first acceptable
permessage-deflateoffer and returns the agreed parameters and theSec-WebSocket-Extensionsresponse value.