Skip to content

Commit

Permalink
chore: debug broadcastMessage on prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Dec 6, 2024
1 parent 30a96ec commit d87b933
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/socket/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export default function socketModule(s: Fastro) {
const entries = connected.entries().toArray();
for (const key in entries) {
const [, { socket }] = entries[key];
socket.send(message);
if (socket.readyState === WebSocket.OPEN) {
socket.send(message);
}
}
}

Expand All @@ -43,7 +45,9 @@ export default function socketModule(s: Fastro) {

for (const key in entries) {
const [, { socket }] = entries[key];
socket.send(JSON.stringify(cc));
if (socket.readyState === WebSocket.OPEN) {
socket.send(JSON.stringify(cc));
}
}
}

Expand Down

0 comments on commit d87b933

Please sign in to comment.