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).
The compressed payload is sent as a JSON wrapper:
{ "compressed": "gzip", "data": "<base64-encoded-gzip-data>" }Clients detect the compressed field and decompress accordingly.
Functions§
- maybe_
compress - Compress a payload if it exceeds the threshold.