cordova-plugin-opentok icon indicating copy to clipboard operation
cordova-plugin-opentok copied to clipboard

#112 Added check to ensure we don't unsubscribe when disconnected

Open wolfenrain opened this issue 6 years ago • 1 comments

Contributing checklist

  • [x] Code must follow existing styling conventions
  • [x] Added a descriptive commit message

Solves issue(s)

#112

Explanation

When disconnecting from session, there are still events being emitted, and depending on which one comes first, it will try to unsubscribe a subscriber while the Session doesn't know the subscriber. And that causes crashes.

I added a simple check to prevent that, it is a different boolean then the sessionConnected boolean because that one gets sets within those events, so it wouldnt have much influences. This way it does not break any of the current code. (also added a subscriberCollection.remove because otherwise it will try to remove subscriber that doesnt exist anymore)

wolfenrain avatar Jul 12 '18 08:07 wolfenrain

@wolfenrain I'm happy to store a disconnected state, but we should use the events such as onConnected, onDisconnected, etc to know the state of the session. WDYT?

msach22 avatar Jan 14 '19 15:01 msach22