diff options
author | 2023-10-17 18:23:10 +0200 | |
---|---|---|
committer | 2023-10-17 09:23:10 -0700 | |
commit | bbc2e96090d3cdc4ccfd5e4456a8d2a236c84c44 (patch) | |
tree | 3a751b358ffb45f68f7101ce2860400500a16414 | |
parent | f53eb7cd599ed242b3830c7c1dc9e78954c3b1f4 (diff) | |
download | bun-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.md | 2 |
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); }, }, }); |