Event compression

Event compression is the reduction of recording payload size before transmission or storage, in rrweb typically via the packer, which deflate-compresses events client-side. Recordings are verbose JSON with high redundancy, so compression routinely cuts transferred bytes by an order of magnitude for content-heavy sessions.

How it works

rrweb ships pack and unpack functions (the @rrweb/packer module, built on the fflate library): pass packFn: pack to record() to compress each event as it is emitted, and unpackFn: unpack to the replayer to reverse it. The storage optimization recipe covers the recording and replay configuration. Compression happens in the user's browser, spending client CPU to save bandwidth and storage; on low-end devices that trade deserves measurement, and moving packing off the main thread is the standard mitigation (see Web Worker recording). Server-side alternatives compress at ingest instead, keeping clients light while still storing compactly; storage-layer compression of full streams at rest compounds with either. Compression is lossless and orthogonal to sampling, which reduces what is captured rather than how it is encoded.

Where you encounter it

Recorder configuration, bandwidth-sensitive deployments (mobile networks), and storage-cost planning.