Skip to content

Commit 5cb8360

Browse files
thomasgauvinOxyjun
andauthored
Update src/content/docs/durable-objects/best-practices/websockets.mdx
Co-authored-by: Jun Lee <[email protected]>
1 parent a1d30d7 commit 5cb8360

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/docs/durable-objects/best-practices/websockets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In addition to [the Web Standard WebSocket API](/workers/runtime-apis/websockets
2828

2929
### How does Durable Object Hibernation work with WebSockets?
3030

31-
When a Durable Object receives no events or messages for 10 seconds, the Durable Object is evicted from memory to avoid unnecessary usage. The WebSocket clients remain connected to the Cloudflare network. When your Durable Object receives an event during hibernation, it is re-instantiated, its `constructor` function is called, and it can access the WebSocket clients with the `this.ctx.getWebSockets()` function.
31+
When a Durable Object receives no events or messages for 10 seconds, the Durable Object is evicted from memory to avoid unnecessary usage. The WebSocket clients remain connected to the Cloudflare network. When your Durable Object receives an event during hibernation, it is re-initialized, its `constructor` function is called, and it can access the WebSocket clients with the `this.ctx.getWebSockets()` function.
3232

3333
When the Durable Object is evicted from memory, its in-memory state is reset. It is common to rely on in-memory state to organize your WebSockets (for example, keeping your WebSockets in rooms with a `Map<WebSocket, Object>` data type). With Hibernation, you must restore the in-memory state of your Durable Object within the `constructor` function.
3434

0 commit comments

Comments
 (0)