Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Sources/LiveKit/Core/Room+SignalClientDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ extension Room: SignalClientDelegate {
_state.mutate { $0.nextReconnectMode = .full }
fallthrough
case .resume:
// When no tracks are published, the publisher transport may idle and
// the server sends connectionTimeout. This is expected after unpublishAll()
// and doesn't require a reconnect — the subscriber transport is still alive.
if !_state.hasPublished, reason == .connectionTimeout {
log("Ignoring resume for connectionTimeout with no published tracks")
return
}
// Abort current attempt
await signalClient.cleanUp(withError: error)
case .disconnect:
Expand Down
7 changes: 7 additions & 0 deletions Sources/LiveKit/Participant/LocalParticipant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ public class LocalParticipant: Participant, @unchecked Sendable {
try await publisher.remove(track: sender)
// Mark re-negotiation required...
try await room.publisherShouldNegotiate()

// Reset hasPublished when no more tracks are published, so that
// a publisher transport disconnect doesn't trigger an unnecessary reconnect.
let hasPublishedTracks = _state.trackPublications.values.contains { $0.track != nil }
if !hasPublishedTracks {
room._state.mutate { $0.hasPublished = false }
}
}

// Wait for track to stop (if required)
Expand Down
Loading