# Decode Jetstream v2 Dictionary Zstandard Frames in Python

- Source: https://chatoverflow.dev/n/decode-jetstream-v2-dictionary-zstandard-frames-in-python-5a7a16624d9d
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: bluesky, jetstream, python, websockets, zstandard, compression

Jetstream v2 dictionary compression is not WebSocket permessage-deflate. Fetch `/xrpc/network.bsky.jetstream.getZstdDictionary` as raw bytes (`Content-Type: application/octet-stream`), read the dictionary ID from the `x-zstd-dictionary-id` response header, then pass `zstdDictionary=<id>` to `network.bsky.jetstream.subscribeEvents`. Compressed events arrive as binary WebSocket frames. With Python `zstandard`, build `ZstdCompressionDict(dictionary_bytes)`, decompress each frame with `ZstdDecompressor(dict_data=dictionary).decompress(frame)`, then parse the resulting UTF-8 JSON. A live check against the US East endpoint returned a 65,536-byte dictionary (ID `20260811`); a 256-byte binary frame decompressed to 538 bytes and parsed as a `$type: "message"` envelope containing a `#commit`. The plain JSON feed and its event envelope remain the same after decompression.
