@reactoo/watchtogether-sdk-js 2.8.0 → 2.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "dist/watchtogether-sdk.min.js",
6
6
  "module": "dist/watchtogether-sdk.min.js",
@@ -1041,7 +1041,7 @@ class RoomSession {
1041
1041
  this.#reconnect()
1042
1042
  .catch(e => {
1043
1043
  if(e.type !== 'warning') {
1044
- this.disconnect();
1044
+ this.disconnect().catch(() => {});
1045
1045
  }
1046
1046
  this.emit('error', e)
1047
1047
  });
@@ -1975,13 +1975,32 @@ class RoomSession {
1975
1975
  await this.#destroyHandle(this.#subscriberHandle?.handleId, false);
1976
1976
 
1977
1977
  this.#wipeListeners();
1978
- if (this.ws && this.ws.readyState === 1) {
1978
+
1979
+ if(!this.useWebsockets) {
1980
+
1981
+ if(this.token) {
1982
+ await this.#send({"janus": "destroy"}, true);
1983
+ }
1984
+ }
1985
+
1986
+ else if (this.ws && this.ws.readyState === 1) {
1979
1987
  await this.#send({"janus": "destroy"}, true);
1980
1988
  this.ws.close();
1981
1989
  }
1982
1990
 
1983
1991
  this.#subscriberJoinPromise = null;
1992
+
1984
1993
  this.sessionId = null;
1994
+ this.server = null;
1995
+ this.protocol = null;
1996
+ this.iceServers = null;
1997
+ this.token = null;
1998
+ this.roomId = null;
1999
+ this.pin = null;
2000
+ this.id = null;
2001
+ this.display = null;
2002
+ this.userId = null;
2003
+
1985
2004
  this.isPublished = false;
1986
2005
  this.isConnected = false;
1987
2006
  this.isDisconnecting = false;