twilio / twilio-video-app-android

A collaboration application built with the Twilio Video Android SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facing issue reconnecting to video call with new token but same identity

him2016 opened this issue · comments

I'm facing a similar issue to this. But no concrete solution was found. Looking forward to getting a reply if this is an issue or am I
doing something wrong here?

twilio/twilio-video.js#1048

Thanks

Hi @him2016 . Thank you for reaching out regarding this issue. Can you please fill out the issue template? This will help us resolve your issue faster by providing specific reproduction steps. Thanks!

@Alton09 Steps for reproduction-

  1. Connect a client to a room using auth token with identity XYZ (Client is connected and no issue)
  2. Client disconnects the call
  3. Client again tries to connect using a new token created for the same identity XYZ (Client gets connected and immediately disconnected throwing this exception TwilioError: Participant disconnected because of duplicate identity)

Hope this helps.

Hi @him2016 . Thank you for the reproduction steps. I have verified that this issue does not occur in this app. Are you facing this issue in this app or in your own?

I found this issue when changed the provided implementation from passcode to token generated on the server. I guess it is due to the singleton object of RoomManager which is created using Dagger. Any thoughts will be helpful.

Hi @him2016 . Do you mind sharing your code that swaps out the passcode logic and a stack trace if it is available? Otherwise It will be hard for us to troubleshoot your exact problem. Also, we swap out the passcode solution with another token generated solution in the internal flavor of the application. You can see how it's done by taking a look at this class. Just note that the internal flavor only works for internal Twilio employees, but it can help show you how the passcode solution can be properly swapped out.

Ok i'll go through the internal flavor application code. If still any issue is found, will share the code snippet.. Thanks.

Hi,
I just went through the code in the shared file. The authToken token implementation is similar. The issue I am getting is inside the RoomManager class. As soon as I try to connect with a new token created using the same identity, the 'onDisconnected' is called with this exception:
com.twilio.video.TwilioException: Participant disconnected because of duplicate identity

Hi @him2016 . Thanks for taking a look at that code. This looks like expected behavior from the Video SDK. You will see this error if you attempt to connect to a room that already contains a participant with the same identity. You would need to change the identity if you would like to connect to a room with the another participant. Do you mind sharing the Room SID after you experience this error? This can be found in the application logs by filtering on sid. It will help us troubleshoot further if needed. Thanks!

I tried to connect with same identity once it was disconnected for the room and I received the disconnect callback. This is the sid I found in the logs: RM68741678564ff1c674b99a38b9ee39fa.

@Alton09 Any progress as to what is causing this and how to handle it?

Hi @him2016 . From looking at the room SID you provided, I do see the Participant disconnected because of duplicate identity but this is due to the fact that the participant is never disconnected before the new one with the same identity joins the room, thus resulting in the error as expected.

I recommend taking a look at the community flavor of the video app as is without any modifications to see how it handles this scenario as I've verified that it handles it properly. Here's the doc on how to quickly get it up and running. Please feel free to reach out for help if needed. Hope this helps!

@Alton09 ok thanks for checking.. will try the same scenario again with the code provided..

@him2016 Closing this one for now. Feel free to reopen if you are still experiencing this issue.