You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example is similar to the [Build a WebSocket server](/durable-objects/examples/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](/durable-objects/best-practices/websockets/).
18
18
@@ -22,84 +22,7 @@ WebSocket Hibernation is unavailable for outgoing WebSocket use cases. Hibernati
@@ -185,8 +108,7 @@ export class WebSocketHibernationServer extends DurableObject {
185
108
}
186
109
}
187
110
```
188
-
189
-
</TabItem> </Tabs>
111
+
</TypeScriptExample>
190
112
191
113
Finally, configure your Wrangler file to include a Durable Object [binding](/durable-objects/get-started/#4-configure-durable-object-bindings) and [migration](/durable-objects/reference/durable-objects-migrations/) based on the namespace and class name chosen previously.
This example shows how to build a WebSocket server using <GlossaryTooltipterm="Durable Object">Durable Objects</GlossaryTooltip> and Workers. The example exposes an endpoint to create a new WebSocket connection. This WebSocket connection echos any message while including the total number of WebSocket connections currently established. For more information, refer to [Use Durable Objects with WebSockets](/durable-objects/best-practices/websockets/).
16
16
@@ -20,91 +20,7 @@ WebSocket connections pin your Durable Object to memory, and so duration charges
@@ -189,8 +105,7 @@ export class WebSocketServer extends DurableObject {
189
105
}
190
106
}
191
107
```
192
-
193
-
</TabItem> </Tabs>
108
+
</TypeScriptExample>
194
109
195
110
Finally, configure your Wrangler file to include a Durable Object [binding](/durable-objects/get-started/#4-configure-durable-object-bindings) and [migration](/durable-objects/reference/durable-objects-migrations/) based on the <GlossaryTooltipterm="namespace">namespace</GlossaryTooltip> and class name chosen previously.
0 commit comments