Skip to content

Commit 4ae0adb

Browse files
pblazejclaude
andcommitted
fix(reconnect): ignore server connectionTimeout when no tracks are published
After unpublishAll(), the publisher transport idles and the server sends LeaveRequest(resume, connectionTimeout). Previously this triggered a needless quick reconnect cycle via the websocket path. Skip the signal cleanup when hasPublished is false and the reason is connectionTimeout, keeping the signal connection alive so re-publishing can proceed without disruption. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c008673 commit 4ae0adb

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Sources/LiveKit/Core/Room+SignalClientDelegate.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ extension Room: SignalClientDelegate {
5858
_state.mutate { $0.nextReconnectMode = .full }
5959
fallthrough
6060
case .resume:
61+
// When no tracks are published, the publisher transport may idle and
62+
// the server sends connectionTimeout. This is expected after unpublishAll()
63+
// and doesn't require a reconnect — the subscriber transport is still alive.
64+
if !_state.hasPublished, reason == .connectionTimeout {
65+
log("Ignoring resume for connectionTimeout with no published tracks")
66+
return
67+
}
6168
// Abort current attempt
6269
await signalClient.cleanUp(withError: error)
6370
case .disconnect:

0 commit comments

Comments
 (0)