@reactoo/watchtogether-sdk-js 2.8.39 → 2.8.40

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.39",
3
+ "version": "2.8.40",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "dist/watchtogether-sdk.min.js",
6
6
  "module": "dist/watchtogether-sdk.min.js",
@@ -63,7 +63,7 @@ let roomSession = function ({roomId, pinHash, role, options = {}}, room, wt) {
63
63
 
64
64
  room.on('error', (e) => {
65
65
  if(e?.type === 'error') {
66
- ___.disconnect(true);
66
+ ___.disconnect();
67
67
  }
68
68
  });
69
69
 
@@ -152,10 +152,10 @@ let roomSession = function ({roomId, pinHash, role, options = {}}, room, wt) {
152
152
  })
153
153
  },
154
154
 
155
- disconnect: function (dontWaitForResponses) {
155
+ disconnect: function () {
156
156
  clearTimeout(alpTimeoutId);
157
157
  abortController?.abort?.();
158
- return room.disconnect(dontWaitForResponses);
158
+ return room.disconnect();
159
159
  },
160
160
 
161
161
  //TODO: refactor restart method
@@ -2098,21 +2098,38 @@ class RoomSession {
2098
2098
  })
2099
2099
  }
2100
2100
 
2101
- await this.#destroyHandle(this.#publisherHandle?.handleId, false);
2102
- await this.#destroyHandle(this.#subscriberHandle?.handleId, false);
2103
-
2101
+ try {
2102
+ await this.#destroyHandle(this.#publisherHandle?.handleId, false);
2103
+ } catch (e) {
2104
+ this._log('Error destroying publisher handle:', e);
2105
+ }
2106
+
2107
+ try {
2108
+ await this.#destroyHandle(this.#subscriberHandle?.handleId, false);
2109
+ } catch (e) {
2110
+ this._log('Error destroying subscriber handle:', e);
2111
+ }
2112
+
2104
2113
  this.#wipeListeners();
2105
2114
 
2106
2115
  if(!this.useWebsockets) {
2107
2116
 
2108
2117
  if(this.token) {
2109
- await this.#send({"janus": "destroy"}, true);
2118
+ try {
2119
+ await this.#send({"janus": "destroy"}, true);
2120
+ } catch (e) {
2121
+ this._log('Error sending destroy message:', e);
2122
+ }
2110
2123
  }
2111
2124
  }
2112
2125
 
2113
2126
  else if (this.ws && this.ws.readyState === 1) {
2114
- await this.#send({"janus": "destroy"}, true);
2115
- this.ws.close();
2127
+ try {
2128
+ await this.#send({"janus": "destroy"}, true);
2129
+ this.ws.close();
2130
+ } catch (e) {
2131
+ this._log('Error in websocket cleanup:', e);
2132
+ }
2116
2133
  }
2117
2134
 
2118
2135
  this.#subscriberJoinPromise = null;