Skip to content

Commit 12452f0

Browse files
committed
Changing .close to console.log
1 parent 5941a14 commit 12452f0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export class WebSocketServer extends DurableObject {
154154
// If the client closes the connection, the runtime will close the connection too.
155155
server.addEventListener("close", (cls) => {
156156
this.currentlyConnectedWebSockets -= 1;
157-
server.close(cls.code, "Durable Object is closing WebSocket");
157+
console.log(cls.code, "Durable Object is closing WebSocket");
158158
});
159159

160160
return new Response(null, {
@@ -204,7 +204,7 @@ export class WebSocketServer extends DurableObject {
204204
// If the client closes the connection, the runtime will close the connection too.
205205
server.addEventListener("close", (cls: CloseEvent) => {
206206
this.currentlyConnectedWebSockets -= 1;
207-
server.close(cls.code, "Durable Object is closing WebSocket");
207+
console.log(cls.code, "Durable Object is closing WebSocket");
208208
});
209209

210210
return new Response(null, {
@@ -295,7 +295,7 @@ export class WebSocketHibernationServer extends DurableObject {
295295

296296
async webSocketClose(ws, code, reason, wasClean) {
297297
// If the client closes the connection, the runtime will invoke the webSocketClose() handler.
298-
ws.close(code, "Durable Object is closing WebSocket");
298+
console.log(code, "Durable Object is closing WebSocket");
299299
}
300300
}
301301
```
@@ -348,7 +348,7 @@ export class WebSocketHibernationServer extends DurableObject {
348348
wasClean: boolean,
349349
) {
350350
// If the client closes the connection, the runtime will invoke the webSocketClose() handler.
351-
ws.close(code, "Durable Object is closing WebSocket");
351+
console.log(code, "Durable Object is closing WebSocket");
352352
}
353353
}
354354
```

src/content/docs/durable-objects/examples/websocket-server.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class WebSocketServer extends DurableObject {
9191
// If the client closes the connection, the runtime will close the connection too.
9292
server.addEventListener('close', (cls) => {
9393
this.currentlyConnectedWebSockets -= 1;
94-
server.close(cls.code, "Durable Object is closing WebSocket");
94+
console.log(cls.code, "Durable Object is closing WebSocket");
9595
});
9696

9797
return new Response(null, {
@@ -174,7 +174,7 @@ export class WebSocketServer extends DurableObject {
174174
// If the client closes the connection, the runtime will close the connection too.
175175
server.addEventListener('close', (cls: CloseEvent) => {
176176
this.currentlyConnectedWebSockets -= 1;
177-
server.close(cls.code, "Durable Object is closing WebSocket");
177+
console.log(cls.code, "Durable Object is closing WebSocket");
178178
});
179179

180180
return new Response(null, {

0 commit comments

Comments
 (0)