PWA & Service Worker (v6)

Caching strategies, offline behavior, and data freshness signaling.

Cache & Strategy Overview

Data Freshness Messaging

When a fresh JSON response is cached, the SW posts a message to all clients:

{
  "type": "DATA_UPDATED",
  "kind": "cultures-index" | "enriched-entry",
  "url": "<request URL>",
  "status": 200,
  "etag": "<ETag or null>",
  "lastModified": "<RFC 1123 date or null>",
  "date": "<ISO 8601 timestamp>"
}
    

The UI (index.js) listens for this message to:

Offline Behavior

Update Flow

Security & CSP

Notes