Nightly: SSE-Client-Handling verbessert (separater Hook, Snapshot/Party-Set + Ping); UI synchronisiert State pro Guild

This commit is contained in:
vibe-bot 2025-08-10 00:11:38 +02:00
parent 21b4e9bd0c
commit c1f4d0f3a0
2 changed files with 27 additions and 13 deletions

View file

@ -975,9 +975,13 @@ app.get('/api/events', (req: Request, res: Response) => {
// Snapshot senden
try { res.write(`data: ${JSON.stringify({ type: 'snapshot', party: Array.from(partyActive) })}\n\n`); } catch {}
// Ping, damit Proxies die Verbindung offen halten
const ping = setInterval(() => { try { res.write(':\n\n'); } catch {} }, 15_000);
sseClients.add(res);
req.on('close', () => {
sseClients.delete(res);
clearInterval(ping);
try { res.end(); } catch {}
});
});