client-sdk-android icon indicating copy to clipboard operation
client-sdk-android copied to clipboard

Unable to Connect to Different LiveKit Session After Disconnecting Using Same Room Instance

Open Pflanzmann opened this issue 2 years ago • 2 comments

Describe the bug

An issue is occurring when using LiveKit.create(context) to create a room, applying ReconnectType.FORCE_FULL_RECONNECT, and injecting this room into our manager.

The bug manifests when disconnecting from the room after a prior connection, where we are unable to connect to a different LiveKit session using the same room instance. This is excepted when attempting to reconnect the room after a delay of a few seconds. The event stream of the room delivers a "Disconnected" event with a null error and a "CLIENT_INITIATED" reason when we attempt to connect to a new session for the first time after the disconnection.

LiveKit.create(context).apply {
  setReconnectionType(ReconnectType.FORCE_FULL_RECONNECT)
}

Steps to Reproduce

  1. Create a room instance using the code above.
  2. Connect to a LiveKit session.
  3. Disconnect from that session.
  4. Attempt to connect to a different LiveKit session using the same room instance.

Expected Behavior

The expected behavior is to successfully connect to the different LiveKit session using the same room instance.

Device Info:

  • Device: Google Pixel 4
  • OS: Android 13
  • LiveKit SDK version: v1.2.1

Additional Context

This issue seems similar to a previously reported bug that has been closed. As the problem still persists, I've opened this new issue.

As a temporary workaround, creating a new room instance for each new connection is possible, but this solution seems inefficient and doesn't align well with our project's architecture. Any assistance in addressing this issue would be greatly appreciated.


Pflanzmann avatar Jun 22 '23 13:06 Pflanzmann

ReconnectType.FORCE_FULL_RECONNECT is only there as a debug option for our own testing purposes; it's not intended to be used in production (it makes the reconnection process to a server more inefficient).

Does this issue still happen without the setReconnectType call?

davidliu avatar Jun 27 '23 04:06 davidliu

Ive tried it without ReconnectType.FORCE_FULL_RECONNECT and I can still not connect and get a CLIENT_INITIATED reason in the disconnect event

Pflanzmann avatar Jun 29 '23 09:06 Pflanzmann