Skip to main content

Module ws_compression

Module ws_compression 

Source
Expand description

Streaming zstd compression for the subscription WebSocket firehose.

One compressor/decompressor per connection, retaining the zstd window across messages (context-takeover) for a high ratio on the similar notification frames. The server compresses each notification into a Binary frame; the client decodes it. The pair is dropped on disconnect, so a reconnect starts a fresh stream. Opt-in rides crate::subscribe_config::SubscribeConfig so it survives the management WebSocket proxy.

Structs§

WsStreamCompressor
Per-connection streaming compressor. Each Self::compress call flushes the zstd stream so the returned bytes independently decode to that one message, while the dictionary window carries over to the next call.
WsStreamDecompressor
Per-connection streaming decompressor, the inverse of WsStreamCompressor. Frames must be fed in the order they were produced.

Constants§

WS_COMPRESSION_LEVEL
zstd level for the firehose; low because the win is context-takeover across similar messages, not the level (and the session workers are CPU-bound).