Skip to content

Commit

Permalink
chore: update socket hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Oct 31, 2024
1 parent 83cb1a7 commit 8d90350
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/socket/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ export default function socketModule(s: Fastro) {
console.log("sockets==>", sockets);
console.log("size", sockets.size);
for (const client of sockets) {
if (client.readyState === WebSocket.CLOSED) {
client.close(1000, "Normal Closure");
sockets.delete(client);
}
if (client.readyState === WebSocket.OPEN) {
client.send(message);
}
}
console.log("size", sockets.size);
}
}

Expand Down

0 comments on commit 8d90350

Please sign in to comment.