From f043baed9f3f3b34dba9586b68a2638282a583a0 Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 18 Mar 2026 20:03:07 +0000 Subject: [PATCH] Fix satellite dashboard page never loading by sending immediate SSE keepalive Werkzeug's dev server buffers SSE response headers until the first body byte is written. With keepalive_interval=30s, opening two SSE connections on DOMContentLoaded (satellite stream + new ground station stream) meant the browser waited 30 seconds before receiving any response bytes from either connection. Browsers keep their loading indicator active while connections are pending, causing the satellite dashboard to appear stuck loading. Fix: yield an immediate keepalive at the start of sse_stream_fanout so every SSE endpoint flushes headers + first data to the browser instantly. Co-Authored-By: Claude Sonnet 4.6 --- utils/sse.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/sse.py b/utils/sse.py index 90694b3..0a5a293 100644 --- a/utils/sse.py +++ b/utils/sse.py @@ -152,6 +152,10 @@ def sse_stream_fanout( ) last_keepalive = time.time() + # Send an immediate keepalive so the browser receives response headers + # right away (Werkzeug dev server buffers headers until first body byte). + yield format_sse({'type': 'keepalive'}) + try: while True: if stop_check and stop_check():