(intervalMs: number = 30_000)
| 370 | } |
| 371 | |
| 372 | startHeartbeat(intervalMs: number = 30_000) { |
| 373 | this.heartbeatInterval = setInterval(() => { |
| 374 | for (const chatId of this.clients.keys()) { |
| 375 | // SSE comment line — ignored by clients but keeps the connection alive through ALB/proxies |
| 376 | this.safeWrite(chatId, ':heartbeat\n\n') |
| 377 | } |
| 378 | }, intervalMs) |
| 379 | } |
| 380 | |
| 381 | stopHeartbeat() { |
| 382 | if (this.heartbeatInterval) { |