fix(call): detect dead signaling WebSocket connections via ping interval - #6543
Open
tareko wants to merge 1 commit into
Open
fix(call): detect dead signaling WebSocket connections via ping interval#6543tareko wants to merge 1 commit into
tareko wants to merge 1 commit into
Conversation
The signaling WebSocket was created from the shared OkHttpClient without a ping interval. In OkHttp 4.x this means no protocol-level pings are sent and the WebSocket read timeout is infinite, so a half-open connection (e.g. after switching from WiFi to cellular without a TCP reset) is never detected: onFailure never fires, the existing reconnect logic never runs, and the call goes silently mute/deaf while participants still appear present. Derive a dedicated client for the signaling WebSocket that pings every 10 seconds. OkHttp now fails the socket when a pong is not received in time, which triggers the existing onFailure -> restartWebSocket path. Regular HTTP calls keep using the unchanged shared client. Assisted-by: opencode:ox-alpha Signed-off-by: Tarek Loubani <tarek@tarek.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(call): detect dead signaling WebSocket connections via ping interval
Description
The signaling WebSocket is currently created from the shared
OkHttpClient, which never sets a ping interval. In OkHttp 4.x this means no protocol-level pings are sent and the WebSocket read timeout is effectively infinite. When the underlying network dies without a TCP reset — the normal case when switching from WiFi to cellular, or when a router/NAT drops an idle mapping — the connection becomes half-open:onFailurenever fires (TCP retransmission timeouts can take 15+ minutes)isConnectedstaystrue, so the existing reconnect logic never runsThe result is a "zombie" call: participants still see each other, but the call is mute/deaf. This is the root cause of the failure mode reported in #2368 and #1760 (analysis also posted on #2368).
This PR derives a dedicated client for signaling WebSocket connections with a 10 second ping interval. OkHttp now fails the socket when a pong is not received in time, which triggers the existing
onFailure→restartWebSocket()path. The shared client used for regular HTTP calls is unchanged (ping intervals have no effect on non-WebSocket calls, but the dedicated instance keeps the change scoped).Steps to reproduce / How to test
Without this PR: the call silently stops working — no reconnect, participants appear present but nothing is transmitted, for 15+ minutes.
With this PR: within ~10–20 seconds the dead socket fails,
onFailuretriggers, and the existing reconnect flow runs (reconnect + hello/resume).Also test that normal call behavior is unaffected: join/leave calls, chat while connected, both WiFi and cellular, with and without HPB.
/backport to stable-24.0may be worthwhile given No automatic reconnect on instable connection #2368 affects older versionsFixes part of #2368
Note: This change was developed with AI assistance (opencode / Kimi K3 and GLM-5.3).