Reading — step 1 of 6
RFC 7692 in one paragraph
~1 min readProduction
permessage-deflate (RFC 7692) is the WebSocket compression extension: it deflate-compresses message payloads before framing. It's negotiated during the handshake — the client offers it in Sec-WebSocket-Extensions: permessage-deflate, the server accepts (optionally with parameters), and from then on either side may send compressed messages.
Three facts anchor everything else:
- It's per-MESSAGE, not per-frame. A fragmented message is compressed as one stream, then split into frames. Only the FIRST frame of a compressed message sets the marker bit.
- The marker is RSV1. That reserved bit in the frame header — which conformance rules say must be 0 — becomes legal only after this extension is negotiated. RSV1=1 on a message means "inflate the payload".
- The stream is raw DEFLATE. No zlib header, no gzip wrapper, no checksum (RFC 7692 §7.2). If your library emits
78 9c ..., you're producing zlib, not raw deflate — every interoperable peer will reject it.
Compression is optional per message: the sender can leave RSV1=0 and send any message uncompressed even after negotiation — worth remembering for payloads that won't shrink.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…