Skip to content

fix: ignore callbacks from a signal socket that was already replaced - #1211

Merged
hiroshihorie merged 26 commits into
mainfrom
hiroshi/signal-socket-generation
Nov 24, 2026
Merged

hiroshihorie merged 26 commits into
mainfrom
hiroshi/signal-socket-generation

Conversation

@hiroshihorie

@hiroshihorie hiroshihorie commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Stacked on #1208.

Problem

A real socket reports its close some time after the SDK disposes it (websocket/io.dart onDone, websocket/web.dart onClose). SignalClient routed that report through the same handler as a live server close. When it landed after the next connection was up, it set the signal state back to disconnected and the engine started a reconnect against a healthy socket.

How late the report comes decides how often this bites:

  • In a browser the close event fires when the server drops TCP. When the server keeps TCP open after the close handshake that is about 2 s later.
  • dart:io reports it when the server answers the close frame. That is quick on a healthy path and late on a dead one, for example after a network change.

Any reconnect replaces the socket, so when the old close lands after the reconnect is done, the room reconnects again, and again, every 2 s or so for as long as the session lives. A disconnect() followed by connect() hits the same path.

Fix

  • Each socket's onData, onDispose and onError callbacks carry the id of the socket they were created for. connect() gives each new socket the next id and cleanUp() advances it too. A callback from another id is dropped with a log line. Same as the JS SDK ignoring a close from a transport that has since been replaced.
  • cleanUp() detaches the old socket before awaiting its close, so a connect() during a slow close keeps its own socket.
  • The signalReconnect and fullReconnect debug scenarios, the disconnectSignalOnResume actions and the connection checker's reconnect check used to call signalClient.cleanUp() and rely on the late close to make the engine recover. That close is now ignored by design, so they call a new internal simulateSignalDrop() which disposes the socket and raises the disconnect explicitly. Same observable behaviour. It does nothing without a connected socket.
  • The mock socket reports its close after dispose() with a configurable latency, like the real implementations.

Tests

test/core/stale_socket_close_test.dart, each fails without its change:

  • a resume or full reconnect completes, then the replaced socket reports its close: one reconnect, room stays connected
  • disconnect, then connect again before the old socket reports its close: no reconnect or disconnect event
  • data a replaced socket delivers late is ignored
  • a connect() while cleanUp() is still closing the old socket keeps its own socket
  • simulateSignalDrop() with no socket does nothing, reports the loss before the close finishes, and reports nothing more after a real close
  • the debug scenarios and the connection checker still start a reconnect

e2e-flutter

Scenarios in livekit/e2e-flutter#39. Only the target's signal socket goes through a proxy that makes the old socket's close late: it delays the server dropping TCP, which is what a browser waits for, and the server's answer to the close frame, which is what dart:io waits for.

Scenario 2.14.0 this PR
Late close of a replaced signal socket after a resume fails, resumes every 2 to 2.5 s passes
Late close of a replaced signal socket after a full reconnect fails, same loop passes
A signal connect answered after its timeout (#1219) fails, duplicateIdentity passes
A signal connect that reaches the server after its timeout (#1219) fails still fails, needs the timed-out connect cancelled, follow-up

Run on macOS against a local livekit-server 1.13.11 and LiveKit Cloud, in Chrome against the local server (the two late close scenarios), and on an iPhone 17 Pro Max and an iPhone 16 Pro on iOS 27.2.1 against LiveKit Cloud. The other reconnect, signaling, lifecycle and RPC scenarios give the same results as on 2.14.0 in each setup.

…echoing the leave

engine.disconnect() sends the Leave and relies on the server's echo to
run cleanup and emit EngineDisconnectedEvent. Media nodes drop queued
leave messages when they close the signal sink, so the echo can be
lost. The socket close was then ignored because _isClosed was set, and
Room.disconnect() waited out its 10 s timeout for an event that never
came, leaving the room half torn down.

The engine now remembers a disconnect that is waiting for its echo and,
on a socket close in that window, runs cleanup and emits the event
itself. A close that follows the echo is still ignored, so there is no
second event.
…of waiting for the echo

The engine used to send the Leave and rely on the server's echo to run
cleanup and emit EngineDisconnectedEvent, and Room.disconnect() waited
up to 10 s for that event. Media nodes drop queued leave messages when
they close the signal sink, so the echo can be lost, and every lost
echo was a 10 s stall, a TimeoutException, and a room left half torn
down. No other SDK waits on the server here.

disconnect() now sends the Leave, runs cleanUp() and emits the event in
one go, like JS, Swift, Android and Rust. A Leave that arrives after
disconnect() started is the echo and is ignored. Room.disconnect() owns
the teardown for the disconnect it started, so the engine event handler
skips its own cleanup in that case and a connect() right after
disconnect() returns cannot race it.

Replaces the earlier socket close fallback on this branch.
A real socket reports its close a few milliseconds after dispose()
returns. That report went through the same handler as a live close, so
when it landed during the next connect it reset the signal state to
disconnected and started a reconnect against a socket that was fine.
Each socket's callbacks now carry a generation, bumped on cleanUp() and
on every connect, and a callback from an older generation is dropped.

The signalReconnect and fullReconnect debug scenarios relied on that
late close to trigger the engine's recovery. They now call
simulateSignalDrop(), which disposes the socket and raises the
disconnect explicitly.

The mock socket reports its close after dispose() like the real ones, so
the race is reproducible in tests.
…ocket

cleanUp() now ignores the close the disposed socket reports afterwards, so
callers that relied on that late close to make the engine recover stopped
working. The connection checker's reconnect check always reported that no
reconnect was attempted, and the disconnectSignalOnResume debug actions never
started the resume the server is waiting for.

Both now call simulateSignalDrop(), like the signalReconnect and fullReconnect
scenarios already do.
disconnect() let the engine handler emit RoomDisconnectedEvent as soon as the
engine had closed, while the room's own teardown was still running. An app that
connects again from that event started its new session in the middle of the
old teardown, which then disposed the new engine state and left the room
disconnected.

The handler now leaves the disconnect it did not start alone, and disconnect()
emits the event after _cleanUp() has finished.
@hiroshihorie
hiroshihorie marked this pull request as ready for review October 16, 2026 21:56

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@hiroshihorie
hiroshihorie added this pull request to stack #1242 October 16, 2026 21:59
_socketGeneration becomes _socketId. The value is compared to decide whether a
callback came from the current socket, which an id describes more directly than
a generation. No behavior change.
…hi/signal-socket-generation

# Conflicts:
#	test/mock/websocket_mock.dart
The close of a replaced socket can reach the client seconds after the reconnect that replaced it, a browser reports it only once the server drops TCP. On main it was taken for a loss of the new socket and every reconnect started the next one. Both shapes fail with the socket id check removed.
@hiroshihorie

Copy link
Copy Markdown
Member Author

Merged main (through #1208) in, resolved the mock conflict, format passes now. Rewrote the description: the late close is seconds late in a browser, not milliseconds, which turns this into a reconnect every 2 s rather than a rare race. Added tests for the resume and full reconnect shapes and the e2e-flutter results.

…eport it when a step fails

Two disconnect() calls that overlapped both passed the closed check, so each sent a Leave, ran the teardown and emitted RoomDisconnectedEvent. They now share the teardown in flight, released before the event so a rejoin from that event gets a teardown of its own on its next disconnect().

A teardown step that threw skipped the room's cleanup or the only RoomDisconnectedEvent, because the engine event handler stays quiet while disconnect() runs. The room's cleanup now runs after a failed engine teardown, the event is emitted either way, and the error still reaches the caller.

The tests now check that the Leave is sent, count engine events in the echo case, and check that the room is torn down when the disconnected event arrives. Found in review (Codex).
…aches the old socket first

A connect whose socket opened only after disconnect() or a newer connect() still installed itself as the current socket, so requests went to the wrong socket and the room could report connected after disconnect() returned. It now closes that socket and fails with SignalConnectSupersededException, which leaves the shared state and events alone and is not a reason to fail over to another region.

cleanUp() detached the socket only after awaiting its close, so a connect() that ran while a dart:io close waited on the server lost its own socket, queue and ping timers when that cleanUp() finished. It now detaches first and awaits the close after.

simulateSignalDrop() does nothing without a socket and reports the loss before the socket has finished closing. The connection checker comment matches what it does now.

Tests: the mock holds old closes until the test releases them, so the late close tests no longer depend on timing, the checker test answers the resume and expects success, and there are new tests for late data from a replaced socket, the superseded connect, the cleanUp() race and a drop with no socket. Each fails without its change. Found in review (Codex).

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 3 new potential issues.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread lib/src/core/signal_client.dart Outdated
Comment on lines +169 to +172
// Attempt to connect. Callbacks carry the id of the socket they belong to
// so a late report from a replaced socket is ignored.
final id = socketId = ++_socketId;
final ws = await _wsConnector(

@devin-ai-integration devin-ai-integration Bot Nov 21, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Stale resume rejects a newer join

If a resume finishes closing its old socket during a new join’s handshake, connect gives the resume the newer ID. The new join then rejects its own successful handshake as superseded.

Learn more

A server migration requesting RESUME reaches resumeConnection while the old signal socket is still open. cleanUp detaches that socket before awaiting its disposal, and the native WebSocket disposer awaits the close. The app can complete disconnect and call Room.connect while that detached socket is closing. If the close finishes while the new join is opening its socket, the old resume claims a later ID and the post-handshake check rejects the new join, regardless of whether the resume itself succeeds.

Example: A migration starts a resume and waits for socket A to close. The app leaves and starts joining another room on socket B. A finishes closing before B opens, so the stale resume claims the current ID. B opens successfully but the SDK disposes it and fails the join.

Recommended fix: Reserve ownership of the connection attempt before asynchronous preparation and teardown. Let connect detach the old socket without invalidating its own reservation, and recheck that reservation before invoking the connector as well as after the handshake. Add a gated test where the old close finishes while the new join is opening.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread lib/src/core/engine.dart Outdated
Comment on lines +357 to +359
// A superseded attempt reports nothing, the connection that replaced it
// is the one the room has.
if (error is SignalConnectSupersededException) rethrow;

@devin-ai-integration devin-ai-integration Bot Nov 21, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Cancelled reconnect restarts the new room

When a full reconnect opens after the app leaves and rejoins, SignalConnectSupersededException still reaches reconnect recovery. attemptReconnect treats it as retryable and restarts the healthy session.

Learn more

A server-requested full reconnect opens a fresh signaling socket through restartConnection. The app can disconnect during that handshake and reuse the room; Engine.connect clears _isClosed and _connect replaces the URL and token. When the old handshake returns, SignalClient.connect discards it with a superseded exception. Without another region, restartConnection propagates that exception, and attemptReconnect sets fullReconnectOnNext and queues a retry. The engine is open again, so the retry tears down the new room's transports in restartConnection. With a regional fallback, restartConnection can start another handshake directly instead of propagating cancellation.

Example: Room A starts a full reconnect. The app leaves A and successfully joins B using the same Room. A's handshake returns late; the old retry starts a full reconnect of B even though B is healthy.

Recommended fix: Propagate supersession past regional failover and treat it as cancellation, not failure, in attemptReconnect. Scope the attempt's retry bookkeeping and finally cleanup to the session that started it. Test a full reconnect held at the handshake while the app disconnects and joins again, then verify that releasing the stale handshake opens no further sockets.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread lib/src/core/signal_client.dart Outdated
Comment on lines +184 to +188
if (id != _socketId) {
// disconnect() or a newer connect() took over while this socket was
// opening. Installing it would take the place of the current one.
await ws.dispose();
throw const SignalConnectSupersededException();

@devin-ai-integration devin-ai-integration Bot Nov 21, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Stale join disables Android call routing

When a cancelled join opens after a successful rejoin, SignalConnectSupersededException reaches Room.connect. Its failure cleanup stops the shared Android audio session, releasing the active call’s audio focus and routing.

Learn more

Room.connect starts native audio before it opens the signal socket. Room._cleanUp stops audio when the app disconnects, and the next join starts it again. When the first socket finally opens, the superseded exception passes through Engine._connect, but the original Room.connect still runs its failure cleanup. In SDK-managed Android mode, NativeAudioManagement.stop stops the shared session, and LKAudioSwitchManager.stop tears down focus and routing rather than releasing an attempt-specific resource.

Example: An Android app cancels a slow join and then joins another room. The new call starts with Bluetooth routing. The first handshake completes late and its error cleanup stops the audio session still in use by the new call.

Recommended fix: Track which room connection attempt owns the native audio setup and make failure cleanup conditional on that ownership. A superseded attempt must not stop audio after a newer attempt has taken ownership. Extend the delayed-handshake regression test to assert that the stale completion causes no extra native audio stop.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

…ardown

25bb462 made overlapping calls share the teardown in flight and reworked the room cleanup to survive a failing step. Sharing makes a disconnect() from a callback the teardown awaits wait on itself, and the zone based way around that is more machinery than this fix should carry. Both behaviours were already on main before this PR.

A disconnect() made while one is tearing down now returns at once, as the Swift SDK does, so one Leave is sent and one disconnect reported, with no shared future. The docs say that such a call does not wait. Room cleanup and the test container are back to what they were. The tests keep the checks on the Leave and the event count, and add one for a disconnect() from a dispose callback.

The server offer handler reads the subscriber once. disconnect() no longer waits for the Leave echo, which used to run after the handler on the same synchronized listener, so it can now clear the subscriber while the handler awaits, and the next subscriber! threw. A full reconnect had the same window. The mock answers too fast to open it, so no test covers this. Found in review (Codex).
…ted socket

The check added in 9552119 covered one case of a connect overtaken by a newer one, but the attempt still takes its socket id only after awaiting the old socket's close, a superseded reconnect still counts as a failed attempt and can fail over, Room.connect() still stops the newer connection's audio, and the app saw an internal exception. Getting that right needs one owner per connection attempt across Room, Engine and SignalClient, which belongs with the per-connection engine session work. SignalClient.connect() is back to what it was, the cleanUp() order stays.

simulateSignalDrop() and the fullReconnect debug scenario now act only on a connected socket. Before, a scenario with no socket armed fullReconnectOnNext, and one right after the server closed the socket reported the same loss again, both turning the next real resume into a full reconnect. A test drives both after a real close and counts the signal losses.

The drop ordering test holds the close with a gate on the mock instead of a delay and fails if the loss is reported only after the close.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +173 to +175
onData: (data) => _ifCurrentSocket(socketId, () => _onSocketData(data)),
onDispose: () => _ifCurrentSocket(socketId, _onSocketDispose),
onError: (error) => _ifCurrentSocket(socketId, () => _onSocketError(error)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Late handshake breaks rejoined room signaling

If an abandoned handshake opens before its timeout but after a rejoin, SignalClient.connect replaces the rejoined room’s socket. Requests go to the abandoned socket, but its replies are ignored because its socket ID is stale.

Learn more

A room can be disconnected and reused while the first WebSocket handshake is still pending. SignalClient.cleanUp invalidates the old socket ID, but SignalClient.connect still installs the socket when that handshake completes. The ID and stored socket then refer to different connections. _sendRequest sends to the stored socket, while only callbacks from the newer connection are accepted.

Example: Start joining room A, cancel while its handshake is pending, and join room B using the same Room instance. When A’s handshake finally completes within the original timeout, a subsequent signaling request for B goes to A instead.

Recommended fix: Check the attempt’s socket ID before installing the result. Dispose an obsolete result and propagate cancellation without letting the obsolete attempt publish a join failure through Engine._connect. Add a regression test that releases the first handshake only after the second room joins, then checks that outgoing requests still use the second socket.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@lukasIO lukasIO left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A heads-up on the changelog entry: this repository moved from .changes/ to verwalter changesets in #1311. The changeset check now looks for a file in .changeset/ instead of .changes/.

Here is your entry in the new format, ready to copy:

.changeset/ignore-replaced-socket-callbacks.md, in place of .changes/ignore-replaced-socket-callbacks:

---
livekit_client: patch
---

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

The type= kind is gone. The changelog adds the PR number and the author to the entry instead. You can also write the file with verwalter changeset --level <level> --package livekit_client --summary "...".

@github-actions

Copy link
Copy Markdown
Contributor

This PR bumps

  • livekit_client: patch

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

This PR bumps

  • livekit_client: patch

Base automatically changed from hiroshi/complete-disconnect-on-socket-close to main November 23, 2026 20:40
hiroshihorie added a commit that referenced this pull request Nov 23, 2026
…of waiting for the server echo (#1208)

## Problem

`engine.disconnect()` sent the Leave and relied on the server's echo to
run cleanup and emit `EngineDisconnectedEvent`, and `Room.disconnect()`
waited up to 10 s for that event. Media nodes drop queued leave messages
when they close the signal sink (`pkg/routing/signal.go`,
`signalMessageSink.Close`, comment in place), so the echo can be lost.
Every lost echo was a 10 s stall, a `TimeoutException` out of
`disconnect()`, and a room left half torn down because
`Room.disconnect()` never reached its own cleanup.

Found by the e2e-flutter suite (livekit/e2e-flutter#7): one agent per
run against a local livekit-server 1.13.6, `SignalClient did disconnect`
with no `Leave received` before it while the server logged `sendLeave:
true`.

This design dates from the Dec 2023 engine rewrite (v1.5.5). #559
(v2.2.2, issue #553) made `Room.disconnect()` wait for the event, which
turned a silently missing event into a visible stall. No other SDK waits
on the server here: JS, Swift, Android and Rust all send the Leave and
tear down locally.

## Fix

Flutter now does the same.

- `engine.disconnect()` sends the Leave, runs `cleanUp()` and emits
`EngineDisconnectedEvent` in one go. No dependency on the echo.
- A Leave that arrives after `disconnect()` started is the echo, or a
server Leave racing ours, and is ignored.
- `Room.disconnect()` awaits the engine teardown and then its own
cleanup, no wait on the server and no timeout. The engine event handler
skips its cleanup while `Room.disconnect()` is running, so teardown has
one owner and a `connect()` right after `disconnect()` returns cannot
race a straggling handler. That is the case behind #553, now covered by
a test.
- A `disconnect()` call made while another one is tearing down returns
at once, as in the Swift SDK. One Leave is sent and one disconnect
reported.
- The server offer handler reads `subscriber` once. `disconnect()` no
longer waits for the echo, so it can clear the subscriber while the
handler awaits.

## Tests

`test/core/disconnect_event_test.dart`:
- socket close without echo completes `disconnect()` with one
`clientInitiated` event
- echo followed by socket close emits exactly one event
- `disconnect()` returns with engine and room torn down when the server
sends nothing at all
- overlapping `disconnect()` calls send one Leave and report one
disconnect
- connect again to the same room right after `disconnect()` returns
- a connect started from the disconnected event survives the old
teardown
- a `disconnect()` from a callback the teardown runs returns at once

The silent server and connect again tests fail on main. The offer
handler change has no test, the mock answers too fast to open that
window.

## e2e-flutter

"Disconnect while the server stops answering", a new scenario for
livekit/e2e-flutter#39. Only the target's signal socket goes through a
proxy, which stops forwarding anything from the server once
`disconnect()` starts, so neither the Leave echo nor the answer to the
WebSocket close frame arrives. That is a lost echo, and also a user who
leaves right after the network died. `disconnect()` must return within 3
s with one `clientInitiated` event and the room torn down, the other
participant must see the leave, and the same `Room` must join again.

| | 2.14.0 | this PR |
|---|---|---|
| macOS, local livekit-server 1.13.11 | `TimeoutException` after 10.0 s
| returns in 39 ms |
| macOS, LiveKit Cloud | not run | returns in 38 ms |
| iPhone 16 Pro (iOS 27.2.1), LiveKit Cloud | `TimeoutException` after
10.0 s | returns in 16 ms |

The existing scenarios that exercise `disconnect()` pass in the same
setups, with #1211 on top: "Connect and disconnect in a loop on one
room" (ten connects and disconnects on one `Room`), "Disconnect
reasons", "Dispose during stream writes", "RPC recipient leaves
mid-call", "Disconnect during a full reconnect stays disconnected" and
"Dispose during a full reconnect stays gone" (#1264, #1268).

The Cloud runs used a regional URL. Against a region pinned project,
every connect on the project URL is refused and goes through region
failover, and the connect loop then fails on its third connect on every
SDK version, the issue #1204 addresses.
Future.timeout stops waiting for a dial but the dial goes on. Its socket
kept the current id until the next connect() or cleanUp(), so a socket
that opened during the retry delay could still deliver a reconnect
response or a close to the engine. A failed connect now retires its id.

Also cover cleanUp() retiring the id of the socket it disposes, which no
test checked.
@hiroshihorie
hiroshihorie merged commit aba1c01 into main Nov 24, 2026
17 checks passed
@hiroshihorie
hiroshihorie deleted the hiroshi/signal-socket-generation branch November 24, 2026 05:03
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants