aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Aral Roca Gomez <aral-rg@hotmail.com> 2023-10-17 18:23:10 +0200
committerGravatar GitHub <noreply@github.com> 2023-10-17 09:23:10 -0700
commitbbc2e96090d3cdc4ccfd5e4456a8d2a236c84c44 (patch)
tree3a751b358ffb45f68f7101ce2860400500a16414
parentf53eb7cd599ed242b3830c7c1dc9e78954c3b1f4 (diff)
downloadbun-bbc2e96090d3cdc4ccfd5e4456a8d2a236c84c44.tar.gz
bun-bbc2e96090d3cdc4ccfd5e4456a8d2a236c84c44.tar.zst
bun-bbc2e96090d3cdc4ccfd5e4456a8d2a236c84c44.zip
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.
-rw-r--r--docs/api/websockets.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/api/websockets.md b/docs/api/websockets.md
index 7722d731a..4e55b8761 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);
},
},
});