From 08fdbb3c7d53dde7eb53feb55fddfbdd63feb4e5 Mon Sep 17 00:00:00 2001 From: Rohit Kaushal <43717403+RohitKaushal7@users.noreply.github.com> Date: Mon, 30 Oct 2023 12:37:50 +0530 Subject: [PATCH] [docs] fix ws/pubsub; closed ws don't publish to topic (#6739) --- docs/api/websockets.md | 2 +- docs/guides/websocket/pubsub.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/websockets.md b/docs/api/websockets.md index 4e55b8761b..7722d731a2 100644 --- a/docs/api/websockets.md +++ b/docs/api/websockets.md @@ -192,7 +192,7 @@ const server = Bun.serve<{ username: string }>({ close(ws) { const msg = `${ws.data.username} has left the chat`; ws.unsubscribe("the-group-chat"); - ws.publish("the-group-chat", msg); + server.publish("the-group-chat", msg); }, }, }); diff --git a/docs/guides/websocket/pubsub.md b/docs/guides/websocket/pubsub.md index 7403d4d2f5..ff3a31fdf1 100644 --- a/docs/guides/websocket/pubsub.md +++ b/docs/guides/websocket/pubsub.md @@ -28,7 +28,7 @@ const server = Bun.serve<{ username: string }>({ }, close(ws) { const msg = `${ws.data.username} has left the chat`; - ws.publish("the-group-chat", msg); + server.publish("the-group-chat", msg); ws.unsubscribe("the-group-chat"); }, },