WebSocket hibernation with Durable Objects
Cloudflare shows how Durable Objects hibernate WebSocket connections while idle.
- Products
- Durable Objects
- Source
- Official docsCloudflare Docs
Key points
- A Durable Object calls ctx.acceptWebSocket for a server-side socket. When idle, the object can leave memory while the WebSocket connection remains open; a later message recreates the object.
- In its constructor, the example retrieves hibernating sockets and restores per-connection state from serialized attachments.
- Hibernation applies only when the Durable Object acts as the WebSocket server; it does not support outbound WebSocket connections.
Original sources
Undated
Original post
Open original source
More to read
D1
D1 status writes: an author reports a 150-dollar charge and refund.
@wofuhuola describes a generated tool writing Reddit post statuses globally every five minutes and deleting expired rows. The author says one month cost 150 dollars, went unnoticed for three months, and was later refunded after an appeal.
Author experienceWorkers +4
Cloudflare billing pitfalls thread
The author organizes Cloudflare billing risks by product and shares experience with budget alert emails.
Browser Rendering
Browser Rendering: an $80 report and a later correction about usage.
@loftwah initially says Browser Rendering charged $80 for services he never used, then clarifies that he had not realized he was using them. A later post says the billing issue remained unresolved.