Expand description
Application-level compression for WebSocket payloads.
Since tokio-tungstenite doesn’t support permessage-deflate, we implement application-level gzip compression for large payloads (like snapshots).
Compressed payloads are sent as raw binary gzip data. Clients detect compression by checking for the gzip magic bytes (0x1f, 0x8b) at the start of binary WebSocket frames.
This approach eliminates the ~33% overhead of base64 encoding that was previously used with JSON-wrapped compressed data.
Enums§
- Compressed
Payload - Result of attempting to compress a payload.
Constants§
- GZIP_
MAGIC - Gzip magic bytes - used by clients to detect compressed frames.
Functions§
- is_gzip
- Check if bytes start with gzip magic bytes.
- maybe_
compress - Compress a payload if it exceeds the threshold.