Skip to content

Commit ec74c7d

Browse files
authored
[Durable Objects] Adding WranglerConfig (#25299)
1 parent 57d302a commit ec74c7d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 5
66
---
77

8-
import { Tabs, TabItem, GlossaryTooltip, Type } from "~/components";
8+
import { Tabs, TabItem, GlossaryTooltip, Type, WranglerConfig } from "~/components";
99

1010
This guide covers how to use Durable Objects as WebSocket servers that can connect thousands of clients (per instance), as well as a WebSocket client to connect to other servers or even Durable Objects.
1111

@@ -140,7 +140,8 @@ export class WebSocketHibernationServer extends DurableObject {
140140

141141
Similar to the [WebSocket Standard API example](/durable-objects/examples/websocket-server/), to execute this code, 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 <GlossaryTooltip term="namespace">namespace</GlossaryTooltip> and class name chosen previously.
142142

143-
```toml title="wrangler.toml"
143+
<WranglerConfig>
144+
```toml
144145
name = "websocket-hibernation-server"
145146

146147
[[durable_objects.bindings]]
@@ -151,6 +152,7 @@ class_name = "WebSocketHibernationServer"
151152
tag = "v1"
152153
new_sqlite_classes = ["WebSocketHibernationServer"]
153154
```
155+
</WranglerConfig>
154156

155157
A full example can be found in [Build a WebSocket server with WebSocket Hibernation](/durable-objects/examples/websocket-hibernation-server/).
156158

@@ -168,11 +170,7 @@ The following are methods available on the **Native Durable Object WebSocket API
168170

169171
#### `WebSocket.serializeAttachment()`
170172

171-
- <code>
172-
{" "}
173-
serializeAttachment(value <Type text="any" />)
174-
</code>
175-
: <Type text="void" />
173+
- <code>{" "}serializeAttachment(value <Type text="any" />)</code>: <Type text="void" />
176174

177175
- Keeps a copy of `value` associated with the WebSocket to survive hibernation. The value can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), which is true of most types. If the value needs to be durable please use [Durable Object Storage](/durable-objects/api/storage-api/).
178176

@@ -370,7 +368,8 @@ export class WebSocketServer extends DurableObject {
370368

371369
To execute this code, 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 <GlossaryTooltip term="namespace">namespace</GlossaryTooltip> and class name chosen previously.
372370

373-
```toml title="wrangler.toml"
371+
<WranglerConfig>
372+
```toml
374373
name = "websocket-server"
375374

376375
[[durable_objects.bindings]]
@@ -381,6 +380,7 @@ class_name = "WebSocketServer"
381380
tag = "v1"
382381
new_sqlite_classes = ["WebSocketServer"]
383382
```
383+
</WranglerConfig>
384384

385385
A full example can be found in [Build a WebSocket server](/durable-objects/examples/websocket-server/).
386386

0 commit comments

Comments
 (0)