From bbc2e96090d3cdc4ccfd5e4456a8d2a236c84c44 Mon Sep 17 00:00:00 2001 From: Aral Roca Gomez Date: Tue, 17 Oct 2023 18:23:10 +0200 Subject: [PATCH] docs: fix ws.publish (#6558) In this example there is no server variable in the context, and here it makes more sense to use ws.publish. It is explained below that once the serve is done, the server.publish can be used. --- docs/api/websockets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/websockets.md b/docs/api/websockets.md index 7722d731a2..4e55b8761b 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"); - server.publish("the-group-chat", msg); + ws.publish("the-group-chat", msg); }, }, });