diff --git a/cortex/static/app.js b/cortex/static/app.js index 0288d18..db5b26e 100644 --- a/cortex/static/app.js +++ b/cortex/static/app.js @@ -1080,6 +1080,13 @@ // ── Real-time Talk updates (SSE) ───────────────────────────── const evtSource = new EventSource('/events'); + // Close cleanly on navigation so the browser doesn't log "connection interrupted" + window.addEventListener('beforeunload', () => evtSource.close()); + + evtSource.onerror = () => { + // EventSource auto-reconnects — nothing to do; suppress console noise + }; + evtSource.onmessage = (e) => { let data; try { data = JSON.parse(e.data); } catch { return; }