From aaf5f719774a9d8ef0154aeee42a34918cdb582c Mon Sep 17 00:00:00 2001 From: Naveed Khan Date: Sat, 6 Jun 2026 14:48:40 +1200 Subject: [PATCH] fix(live-feed): stream SSE through proxies and show real connection state - api: send X-Accel-Buffering: no on /logs/stream so nginx-style proxies do not buffer the event stream - ui: update live feed placeholder on SSE open/error instead of sitting on "Connecting..." until the first event arrives --- src/public/index.html | 12 ++++++++++-- src/routes/api.js | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/public/index.html b/src/public/index.html index 8a79ef3..aaf1642 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -540,8 +540,16 @@

EpisodeGuard { const d=document.getElementById('live-dot'); if(d)d.classList.remove('paused'); }; - sseSource.onerror = () => { const d=document.getElementById('live-dot'); if(d)d.classList.add('paused'); }; + sseSource.onopen = () => { + const d=document.getElementById('live-dot'); if(d)d.classList.remove('paused'); + const empty=document.getElementById('live-feed')?.querySelector('.live-empty'); + if(empty) empty.textContent='Connected. Waiting for new events...'; + }; + sseSource.onerror = () => { + const d=document.getElementById('live-dot'); if(d)d.classList.add('paused'); + const empty=document.getElementById('live-feed')?.querySelector('.live-empty'); + if(empty) empty.textContent='Disconnected. Reconnecting...'; + }; } function initLiveFeed() { diff --git a/src/routes/api.js b/src/routes/api.js index d2c4a20..38e20fb 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -67,6 +67,7 @@ router.get('/logs/stream', (req, res) => { res.setHeader('Content-Type', 'text/event-stream'); res.setHeader('Cache-Control', 'no-cache'); res.setHeader('Connection', 'keep-alive'); + res.setHeader('X-Accel-Buffering', 'no'); // stop nginx/proxy buffering so SSE streams immediately res.flushHeaders(); // Seed with events from the last 10 minutes only