Skip to content

Commit 7f975ef

Browse files
committed
fix: use getWebSockets method
1 parent b3013cd commit 7f975ef

File tree

1 file changed

+3
-2
lines changed
  • src/content/docs/workers/tutorials/live-cursors-with-nextjs-rpc-do

1 file changed

+3
-2
lines changed

src/content/docs/workers/tutorials/live-cursors-with-nextjs-rpc-do/index.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ that will be made available to the Next.js Worker using a [`WorkerEntrypoint`](/
202202
}
203203

204204
broadcast(message: WsMessage, self?: string) {
205-
this.sessions.forEach((session, ws) => {
206-
session.id !== self && ws.send(JSON.stringify(message));
205+
this.ctx.getWebSockets().forEach((ws) => {
206+
const { id } = ws.deserializeAttachment();
207+
if (id !== self) ws.send(JSON.stringify(message));
207208
});
208209
}
209210

0 commit comments

Comments
 (0)