demo · v130
Handshake protocol walkthrough
Step through the message exchange that drives shared-brotli compression: dictionary fetch, browser registration via Use-As-Dictionary, follow-up request carrying Available-Dictionary: :sha256:, the dcb-encoded response, and the plain Brotli fallback when the dictionary is missing or mismatched.
Browser
—
—
—
—
→
←
→
←
Server
—
—
—
—
cumulative wire-bytes saved (vs fresh brotli)
the code
// Step 2 — server promotes the dictionary
res.set("Use-As-Dictionary", 'match="/static/app-v*.js", type="raw"');
res.set("Cache-Control", "public, max-age=2592000");
// Step 3 — Chrome sends with the next matching request, automatically
GET /static/app-v4.js
Accept-Encoding: gzip, br, zstd, dcb, dcz
Available-Dictionary: :7f8c…b9e3a: // SHA-256 of app-v3.js
// Step 4 — server responds delta-compressed against that dictionary
HTTP/1.1 200 OK
Content-Encoding: dcb
Vary: Accept-Encoding, Available-Dictionary
// Fallback A — no matching dictionary in the browser cache
GET /static/app-v4.js
Accept-Encoding: gzip, br, zstd
// Fallback B — stale or wrong advertised hash
GET /static/app-v4.js
Accept-Encoding: gzip, br, zstd, dcb, dcz
Available-Dictionary: :0000…dead:
HTTP/1.1 200 OK
Content-Encoding: br
Vary: Accept-Encoding, Available-Dictionary