Repository navigation
Restart signal pings after a resume - #1328
Merged
Merged
Conversation
The pings and the ping timeout only started on a JoinResponse. A resume gets a ReconnectResponse instead, and connect() had already cleared the timers of the old socket, so after the first resume no pings were sent and a dead signal socket was never detected for the rest of the session. Start them again when the ReconnectResponse arrives, with the interval and timeout kept from the JoinResponse, as client-sdk-js, Android and Rust do.
Contributor
|
This PR bumps
|
hiroshihorie
marked this pull request as ready for review
December 1, 2026 05:12
hiroshihorie
requested review from
changt,
cloudwebrtc and
xianshijing-lk
as code owners
December 1, 2026 05:12
A join with a ping timeout but a zero interval started a periodic timer with no period, which sends pings in a tight loop, and with this branch it would do so again after every resume. Pings now need both values to be positive, as the Swift SDK requires, and a join without them turns pings off like a join that omits them.
hiroshihorie
added a commit
that referenced
this pull request
Dec 4, 2026
<!-- verwalter release --> Merging this PR releases: ## livekit_client `2.14.0` → `2.15.0` ### Minor Changes - RTCConfiguration.continualGatheringPolicy. Peer connections now gather ICE candidates continually by default, like the Swift, Android and JS SDKs, so a network change such as Wi-Fi to cellular produces new candidates without waiting for an ICE restart. Set RTCContinualGatheringPolicy.gatherOnce to keep the previous behavior. - [#1311](#1311) ([@lukasIO](https://github.com/lukasIO)) - LiveKitClient.initialize() now enables enableWARP and zeroPlayoutDelay by default. Pass false to keep the previous behavior - [#1321](#1321) ([@cloudwebrtc](https://github.com/cloudwebrtc)) - Data published without reliable: true is no longer retransmitted, because the maxRetransmits of 0 on the lossy data channel now reaches the platform - [#1323](#1323) ([@hiroshihorie](https://github.com/hiroshihorie)) - Single peer connection support - [#1025](#1025) ([@hiroshihorie](https://github.com/hiroshihorie)) ### Patch Changes - Keep one dependency descriptor extension id across the SDP bundle - [#1310](#1310) ([@cloudwebrtc](https://github.com/cloudwebrtc)) - disconnect() tears the room down locally after sending the Leave instead of waiting for the server to echo it, so it no longer stalls 10 s when the echo is lost. A disconnect() call while one is already tearing down returns at once, so one Leave is sent and one disconnect reported - [#1208](#1208) ([@hiroshihorie](https://github.com/hiroshihorie)) - A late close from a signal socket the SDK already replaced no longer starts another reconnect. In a browser it arrives up to seconds later, which made a room resume every 2 s after its first reconnect - [#1211](#1211) ([@hiroshihorie](https://github.com/hiroshihorie)) - Update the Rust core (livekit_ffi) to 0.16.0 - [#1329](#1329) ([@hiroshihorie](https://github.com/hiroshihorie)) - Mark SDK plumbing members such as `LocalVideoTrack.subscribedCodecs`, the `prevStats` fields of tracks and the proto conversions of `RpcError` as `@internal`, so the analyzer warns when an app uses them. - [#1314](#1314) ([@hiroshihorie](https://github.com/hiroshihorie)) - Offers and answers now carry offer ids, so a late answer to an offer that an ICE restart or a newer offer replaced is ignored instead of being applied to the wrong offer - [#1262](#1262) ([@hiroshihorie](https://github.com/hiroshihorie)) - A track that fails to republish after a full reconnect no longer leaves the tracks after it unpublished or the room without a `RoomReconnectedEvent`. The failure is logged, the track is reported with a `LocalTrackUnpublishedEvent`, and the remaining tracks are republished - [#1302](#1302) ([@j-mercker](https://github.com/j-mercker)) - Signal pings and the ping timeout now restart after a resume, so a signal connection that goes dead after a resume is detected and recovered instead of going unnoticed for the rest of the session - [#1328](#1328) ([@hiroshihorie](https://github.com/hiroshihorie)) - Fully reconnect when a resume cannot restart ICE because the pending offer no longer matches the last answer - [#1025](#1025) ([@hiroshihorie](https://github.com/hiroshihorie)) - A resume now ends as soon as the server asks for a full reconnect or the signal connection drops, instead of waiting out a timeout of up to 10 seconds, and a resume the server gave up on is no longer reported as reconnected before the full reconnect - [#1322](#1322) ([@hiroshihorie](https://github.com/hiroshihorie)) - A resume now waits until the publisher has finished its ICE restart before the room reports it reconnected, so reliable data sent right after a node migration is no longer lost, and a publisher that cannot reconnect leads to a full reconnect instead of repeated resumes. - [#1315](#1315) ([@hiroshihorie](https://github.com/hiroshihorie)) - Negotiate Opus NACK on every audio section in single peer connection mode, including send-only offers created before any subscriptions, enabling retransmission of lost audio in both publish and subscribe directions when RED is disabled, such as with end-to-end encryption. Accept server-offered Opus NACK in dual peer connection subscriber answers, with fallback if the modified answer is rejected - [#1025](#1025) ([@hiroshihorie](https://github.com/hiroshihorie)) - Web: a signal connection that fails after it opened no longer throws an uncaught Future already completed error - [#1303](#1303) ([@j-mercker](https://github.com/j-mercker)) - Update flutter_webrtc to 1.7.0 and WebRTC-SDK to 150.7871.09, which on iOS stops the audio engine from starting twice when an audio interruption ends and lets it start again after a failed audio session deactivation - [#1323](#1323) ([@hiroshihorie](https://github.com/hiroshihorie)) Changesets: `continual-gathering-policy.md`, `dd-extension-bundle-id.md`, `disconnect-completes-on-socket-close.md`, `enable-warp-zero-playout-by-default.md`, `ignore-replaced-socket-callbacks.md`, `livekit-ffi-0.16.md`, `lossy-data-channel-unreliable.md`, `mark-internal-api.md`, `offer-ids.md`, `republish-all-tracks-after-failure.md`, `restart-pings-after-resume.md`, `resume-pending-offer.md`, `resume-stops-on-reconnect-leave.md`, `resume-waits-for-publisher.md`, `single-pc-opus-nack.md`, `single-pc.md`, `web-websocket-error-after-open.md`, `webrtc-150-7871-09.md` --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com>
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.
Problem
SignalClientstarts the signal pings and the ping timeout only when a JoinResponse arrives.connect()cleans up the old socket, which cancels both timers. A resume gets a ReconnectResponse and no JoinResponse, so after the first resume no pings are sent and no ping timeout is armed for the rest of the session, until a full reconnect.What that hurts:
pingReq. It does not time out the client for that, but itslastSignalAtgoes stale when nothing else is sent for 15 seconds, which turns off its ICE failure candidate fallback and its TCP fallback (pkg/rtc/transportmanager.goin livekit/livekit). The signalling RTT also stops updating on both sides.Fix
Restart the pings when the ReconnectResponse arrives, with the interval and timeout kept from the JoinResponse. The fields are not cleared by
cleanUp(), so they are still set on a resume.How the other SDKs do it:
handleSignalConnectedfor a join and for a reconnect, with the values cached from the JoinResponse.restart(), with the stored JoinResponse._restartPingTimer()on the ReconnectResponse, butcleanUp()clears the cached JoinResponse first, so it has the same gap. That needs its own fix.Testing
test/core/signal_client_test.dart: join with a 1 second interval and a 2 second timeout, resume, then check that pings go out on the new socket and that the timeout reports the socket as lost when no pong comes back. It fails on main and passes with the fix.flutter test(all unit tests) andflutter analyzepass locally.