fix: stabilize color mapping by using persistent global hash and add SSE heartbeat
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m18s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m18s
This commit is contained in:
@@ -74,9 +74,15 @@ app.get('/api/stream', (req, res) => {
|
||||
// Send initial connection event
|
||||
res.write('data: {"connected": true}\n\n');
|
||||
|
||||
// Keep connection alive through Nginx/Cloudflare
|
||||
const keepAlive = setInterval(() => {
|
||||
res.write(':\n\n'); // SSE comment to prevent idle timeout
|
||||
}, 15000);
|
||||
|
||||
sseClients.add(res);
|
||||
|
||||
req.on('close', () => {
|
||||
clearInterval(keepAlive);
|
||||
sseClients.delete(res);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user