(broadcasterId, message)
| 71 | } |
| 72 | |
| 73 | function handleSendBroadcast(broadcasterId, message) { |
| 74 | const forwarded = { |
| 75 | version: PROTOCOL_VERSION, |
| 76 | method: message.method, |
| 77 | params: message.params, |
| 78 | }; |
| 79 | for (const [otherId, otherWs] of clients) { |
| 80 | if (otherId !== broadcasterId) { |
| 81 | try { |
| 82 | otherWs.send(JSON.stringify(forwarded)); |
| 83 | } catch (e) { |
| 84 | console.error(`Failed to send broadcast to client: '${otherId}' ` + |
| 85 | `due to:\n ${e.toString()}`); |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | wss.on('connection', function(clientWs) { |
| 92 | const clientId = `client#${nextClientId++}`; |
no test coverage detected
searching dependent graphs…