(h)
| 15 | |
| 16 | const allocSse = (es) => { sseSources.push(es); return sseSources.length - 1; }; |
| 17 | const sse = (h) => { |
| 18 | if (h < 0 || h >= sseSources.length || sseSources[h] === null) { |
| 19 | throw new Error('invalid sse handle: ' + h); |
| 20 | } |
| 21 | return sseSources[h]; |
| 22 | }; |
| 23 | |
| 24 | return { requests, sockets, sseSources, allocSocket, socket, allocSse, sse }; |
| 25 | }; |