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.
This commit is contained in:
Aral Roca Gomez
2023-10-17 18:23:10 +02:00
committed by GitHub
parent f53eb7cd59
commit bbc2e96090

View File

@@ -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);
},
},
});