(ws)
| 6 | const sseSources = []; // EventSource per sse_open; nulled on close. |
| 7 | |
| 8 | const allocSocket = (ws) => { sockets.push(ws); return sockets.length - 1; }; |
| 9 | const socket = (h) => { |
| 10 | if (h < 0 || h >= sockets.length || sockets[h] === null) { |
| 11 | throw new Error('invalid socket handle: ' + h); |