Nightly: SSE-Client-Handling verbessert (separater Hook, Snapshot/Party-Set + Ping); UI synchronisiert State pro Guild
This commit is contained in:
parent
21b4e9bd0c
commit
c1f4d0f3a0
2 changed files with 27 additions and 13 deletions
|
|
@ -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 {}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue