Ravinder Payal
Ravinder Payal

Reputation: 3031

Opentok Javascript: On self session/connection disconnect?

Opentok Javascript: On self session/connection disconnect? I tried all the possible events, following code logs into the console when other deivces disconnects, but it never logs anything when it, itself, disconnects. Please point toward the even which is fired when the session is disconnected. I have tried sessionDisconnect as well without any luck.

this.session.on("connectionDestroyed", function(event) {
  console.log(event);
});

Thanks in advance.

Upvotes: 0

Views: 170

Answers (1)

Manik
Manik

Reputation: 1515

TokBox Developer Evangelist here.

The Session object dispatches SessionDisconnectEvent object when a session has disconnected. You mentioned that you tried, sessionDisconnect, but the event is actually sessionDisconnected.

You can listen to the event as such:

this.session.on("sessionDisconnected", function(event) {
  console.log(event);
});

The connectionDestroyed event is dispatched when other connections leave the session.

Upvotes: 1

Related Questions