Stop watching and end every open stream. Idempotent.
()
| 253 | |
| 254 | /** Stop watching and end every open stream. Idempotent. */ |
| 255 | close(): void { |
| 256 | this.closed = true; |
| 257 | this.stopWatching(); |
| 258 | for (const client of [...this.clients]) { |
| 259 | clearInterval(client.heartbeat); |
| 260 | this.clients.delete(client); |
| 261 | try { |
| 262 | client.res.end(); |
| 263 | } catch { |
| 264 | /* the socket is already gone */ |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | /* ------------------------------------------------------------ plumbing -- */ |
| 270 |
no test coverage detected