We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getWebSockets
1 parent b3013cd commit 7f975efCopy full SHA for 7f975ef
src/content/docs/workers/tutorials/live-cursors-with-nextjs-rpc-do/index.mdx
@@ -202,8 +202,9 @@ that will be made available to the Next.js Worker using a [`WorkerEntrypoint`](/
202
}
203
204
broadcast(message: WsMessage, self?: string) {
205
- this.sessions.forEach((session, ws) => {
206
- session.id !== self && ws.send(JSON.stringify(message));
+ this.ctx.getWebSockets().forEach((ws) => {
+ const { id } = ws.deserializeAttachment();
207
+ if (id !== self) ws.send(JSON.stringify(message));
208
});
209
210
0 commit comments