Build a WebSocket server with WebSocket Hibernation
Build a WebSocket server using WebSocket Hibernation on Durable Objects and Workers.
This example is similar to the Build a WebSocket server example, but uses the WebSocket Hibernation API. The WebSocket Hibernation API should be preferred for WebSocket server applications built on Durable Objects, since it significantly decreases duration charge, and provides additional features that pair well with WebSocket applications. For more information, refer to Use Durable Objects with WebSockets.
Finally, configure your wrangler.toml
file to include a Durable Object binding and migration based on the namespace and class name chosen previously.