From f26acc409a1cbec4104376a466f62835d1796071 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Feb 2026 16:01:22 -0600 Subject: [PATCH] Fix WebSocket proxy ping timeout killing MSE streams The websockets library defaults to ping_interval=20, ping_timeout=20. go2rtc doesn't respond to these pings, so the upstream WebSocket was being killed after ~50 seconds causing all camera streams to freeze. Disabled ping_interval and ping_timeout on the upstream connection. --- backend/routes/go2rtc_proxy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/routes/go2rtc_proxy.py b/backend/routes/go2rtc_proxy.py index b0c5c15..4d7860a 100644 --- a/backend/routes/go2rtc_proxy.py +++ b/backend/routes/go2rtc_proxy.py @@ -43,7 +43,12 @@ async def proxy_mse_ws(ws: WebSocket, src: str): await ws.accept() try: - async with websockets.connect(target) as upstream: + async with websockets.connect( + target, + ping_interval=None, + ping_timeout=None, + close_timeout=5, + ) as upstream: async def forward_to_client(): async for msg in upstream: