Recommended for production. Compression reduces bandwidth by ~60% with no latency impact.
Every event is compressed once on the server and delivered to all subscribers — zero per-connection overhead.
Enable it by adding
&compress=zlib to your connection URL.How it works
When you connect with&compress=zlib, the server sends settlement events as deflate-compressed binary frames instead of JSON text frames. Your client decompresses each binary frame with standard zlib inflateRaw — available in every language.
Control messages (subscribe acknowledgments, errors, heartbeats, pong) are still sent as normal JSON text, so you can always read them directly.
Bandwidth savings
Measured in production on real settlement data:| Mode | Per-connection | Max connections (1 Gbps) | Max connections (10 Gbps) |
|---|---|---|---|
| Uncompressed | ~0.78 Mbps | ~1,000 | ~10,000 |
| Compressed | ~0.32 Mbps | ~2,500 | ~25,000 |
Client examples
- JavaScript / Node.js
- Python
- Go
- Rust
- Browser (pako)
Key details
What gets compressed?
What gets compressed?
Only live event frames (settlements, status updates, trades) are sent as compressed binary.These are always sent as normal JSON text:
{"type": "snapshot", ...}— initial event snapshot{"type": "subscribed", ...}— subscription acknowledgment{"type": "unsubscribed", ...}— unsubscribe confirmation{"type": "heartbeat", ...}— server heartbeat{"type": "pong"}— ping response{"type": "error", ...}— error messages
How do I tell if a frame is compressed?
How do I tell if a frame is compressed?
Check the WebSocket frame type:
- Binary frame → compressed event, decompress with
inflateRaw - Text frame → normal JSON, parse directly
isBinary in Node.js ws, isinstance(msg, bytes) in Python).What compression algorithm is used?
What compression algorithm is used?
Raw deflate (RFC 1951) via the
flate2 Rust crate with fast compression level.
Decompress with inflateRaw / zlib.decompress(data, -zlib.MAX_WBITS) — not inflate or gunzip.Does compression add latency?
Does compression add latency?
No measurable impact. Each event is compressed once on the server (~0.05ms for a 1.2 KB message),
then the same compressed bytes are sent to all compressed subscribers via zero-copy fan-out.
Decompression on the client is equally fast.
Can I mix compressed and uncompressed?
Can I mix compressed and uncompressed?
Compression is set per connection at connect time. You cannot toggle it mid-session.
Different connections from the same API key can use different modes.
When to use compression
| Scenario | Recommendation |
|---|---|
| Production bots / trading systems | Use compression — saves bandwidth, no downside |
| Prototyping / debugging | Skip compression — raw JSON is easier to inspect |
| High-frequency firehose | Use compression — critical at scale |
| Browser dashboards | Use compression with pako — reduces data transfer |

