mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-06 15:12:30 +09:00
The current Manager only falls back on hard handshake failures (RSV1 / engine.io). It doesn't catch the more common CF-tunnel failure mode the user observed in events.json: WS authenticates fine, stays alive 2-3 minutes, drops, reconnects, drops again, forever. Each cycle pays an auth round-trip and burns bandwidth on retry/backoff loops without ever delivering live streams. Add a stability monitor that samples IsConnected() at 1Hz, records disconnect timestamps in a sliding 10-minute window, and triggers runFallback() permanently after 3 disconnects in window. Once on poll, no more reconnect churn — heartbeat + buffered capability/ sysinfo get delivered cleanly through the REST endpoint that the intermediary doesn't mangle. Restart-to-recover semantics preserved (matches the existing "stay on poll until process restart" rule). Threshold (3 drops / 10 min) is conservative: a single drop or two from a brief network blip won't trigger; only sustained unreliability does. Users with healthy direct WS connections never hit this path at all. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>