Reputation: 2664
I'm using OpenTok client SDK for Web, and I'm having some issues when reconnecting a session if it can't automatically reconnect; some lingering socket connection seem to remain not properly closed.
I'm simulating a network disconnection and the Automatic Reconnection feature works perfectly: the client tries reconnecting for around 30 seconds and succeeds if the client regains network connection.
But if the client can't reconnect a sessionDisconnected
event is dispatched. In this case, I still want to reconnect to the session and I'm trying to do that manually, so I do the whole thing again - please notice it's pseudocode:
// 1st I hide my OTPublisher element (I'm using opentok-react) so it's cleaned up properly
session = OT.initSession(apiKey, sessionId);
session.on(myEventHandlers);
session.connect(...);
// Finally show my OTPublisher again
This works fine, the publisher starts publishing again, BUT I then see my handlers for sessionReconnecting
& sessionReconnected
events keep being called, so this means these events are being dispatched again and again. I also see a OpenTok:ReconnectableSocket
warn, and I'm afraid some stuff is not properly being cleaned:
So, what should be the proper way to cleanup the session on sessionDisconnected
event so the client can connect to it again?
Upvotes: 1
Views: 666
Reputation: 1537
Adam here from the OpenTok Team. You have actually run into a bug that we are in the process of fixing. We hope to get a fix out in the next week or so along with some other fixes. Stay tuned and sorry for the inconvenience! What you are doing should totally work.
Upvotes: 1