Spaces:
Sleeping
Sleeping
| function send(ws, msg) { | |
| if (ws.readyState === ws.OPEN) ws.send(JSON.stringify(msg)); | |
| } | |
| function broadcast(room, msg, exclude) { | |
| for (const p of room.participants) { | |
| if (p !== exclude) send(p, msg); | |
| } | |
| } | |
| module.exports = { send, broadcast }; | |