An always-awake chat DO is an always-awake bill. With the Hibernation WebSocket API, after a short idle the object leaves memory; client sockets remain pinned at the edge. A message wakes the constructor again.
Prefer ctx.acceptWebSocket(server) plus webSocketMessage/Close/Error. Stash small per-socket metadata with serializeAttachment / deserializeAttachment.
Fields, timers, in-flight fetch, closures. What remains: SQLite rows, alarms, attachments. Persist first.
Open I/O, waitUntil work, standard WebSocket accept paths, live timers.
Hibernation does not hang up the user — it unloads the process.
Part 4 stacks memory, SQLite, and cold storage into tiers.