fix: add pong/timeout detection to prevent silent connection hangs
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m2s

- Backend now responds to __ping__ with __pong__
- Frontend detects missing pong within 5s and closes connection
- This triggers proper reconnect/auth recovery instead of hanging
- Fixes 'keepalive ping timeout' issue where connection appears alive but is dead
This commit is contained in:
Gan, Jimmy
2026-03-11 23:55:51 +08:00
parent 74100c8882
commit e0f432bc39
2 changed files with 26 additions and 1 deletions
+1
View File
@@ -180,6 +180,7 @@ async def ws_endpoint(websocket: WebSocket, host: str = Query("nas"), token: str
process.stdin.write(data)
elif "text" in msg and msg["text"]:
if msg["text"] == "__ping__":
await websocket.send_text("__pong__")
continue
process.stdin.write(msg["text"].encode())
except Exception as e: