Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disputable logic when SDK switches ConnectionState to reconnecting #607

Open
bombruch opened this issue Feb 25, 2025 · 0 comments
Open

Disputable logic when SDK switches ConnectionState to reconnecting #607

bombruch opened this issue Feb 25, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@bombruch
Copy link

bombruch commented Feb 25, 2025

Environment:
SDK version: 2.0.19
iOS: any
Reproduces on minimal UIKit SDK example: yes

Steps to reproduce:

  1. Configure ConnectOptions by default except 2 params:
ConnectOptions(
	reconnectAttempts: 30,
	reconnectAttemptDelay: 1
)
  1. Connect to room
  2. Turn off any internet connection and observe logs/publishers/delegate methods.

Current behaviour (CB):
CB1) SDK:
30 retries every ~second and disconnect after ~30 seconds. Under the hood: SDK makes 29 quick reconnects.

Logs ... 2025-02-25T15:03:55+0300 debug LiveKitSDK : [LiveKit] Room.startReconnect(reason:nextReconnectMode:) [Connect] Retry in 1.0 seconds, 26/30 tries left. 2025-02-25T15:03:55+0300 debug LiveKitSDK : [LiveKit] Room.quickReconnectSequence() [Connect] Starting .quick reconnect sequence... ...

and last one as full reconnect. SDK switches ConnectionState to reconnecting only when full reconnect is performed.

Logs ... 2025-02-25T15:03:59+0300 debug LiveKitSDK : [LiveKit] Room.startReconnect(reason:nextReconnectMode:) [Connect] Retry in 1.0 seconds, 30/30 tries left. 2025-02-25T15:03:59+0300 debug LiveKitSDK : [LiveKit] Room.init(delegate:connectOptions:roomOptions:) connectionState: .connected -> .connected, reconnectMode: Optional(.full) 2025-02-25T15:03:59+0300 debug LiveKitSDK : [LiveKit] Room.fullReconnectSequence() [Connect] starting .full reconnect sequence... 2025-02-25T15:03:59+0300 debug LiveKitSDK : [LiveKit] Room.init(delegate:connectOptions:roomOptions:) connectionState: .connected -> .reconnecting, reconnectMode: Optional(.full) 2025-02-25T15:03:59+0300 debug LiveKitSDK : [LiveKit] Room.cleanUp(withError:isFullReconnect:) withError: nil, isFullReconnect: true ...

CB2) Apps that use SDK and as a result user interface:
Clients see no changes so for ~29 seconds user can observe that everything is OK and only during last second user can see reconnecting state.

Expected behaviour:
SDK changes ConnectionState to reconnecting as early as possible.

Proposed updates:

  • switch to reconnecting state after first quick reconnect
  • or expose ReconnectMode as delegate and/or publisher. So clients can observe and react to it
  • or may be add more ConnectionState - quickReconnecting and fullReconnecting
  • or any other options that can help to get reconnect info without any SDK hacks.
@bombruch bombruch added the enhancement New feature or request label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants