@reactoo/watchtogether-sdk-js 2.7.59 → 2.7.61

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.7.59",
3
+ "version": "2.7.61",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "dist/watchtogether-sdk.min.js",
6
6
  "module": "dist/watchtogether-sdk.min.js",
package/src/models/iot.js CHANGED
@@ -235,6 +235,12 @@ let iot = function () {
235
235
  this.__privates.iot.log('Ignoring connection check failure, not connected');
236
236
  return Promise.resolve();
237
237
  }
238
+
239
+ if(isReconnecting) {
240
+ this.__privates.iot.log('Connection check failed, but we are already reconnecting...');
241
+ return Promise.resolve();
242
+ }
243
+
238
244
  this.__privates.iot.log('Connection check failed:', error);
239
245
  return this.iot.__updateCredentials();
240
246
  });
@@ -43,10 +43,6 @@ class Iot {
43
43
  this.lastConnectParams = { apiMqttUrl, apiMqttClientId, region, accessKeyId, secretAccessKey, sessionToken, expiration };
44
44
 
45
45
  return new Promise((resolve, reject) => {
46
- const timeoutId = setTimeout(() => {
47
- this.off('worker:connect_result');
48
- reject(new Error('Connection timeout'));
49
- }, 5000);
50
46
 
51
47
  const handleConnectResult = (event) => {
52
48
  clearTimeout(timeoutId);
@@ -59,6 +55,11 @@ class Iot {
59
55
  }
60
56
  };
61
57
 
58
+ const timeoutId = setTimeout(() => {
59
+ this.off('worker:connect_result', handleConnectResult);
60
+ reject(new Error('Connection timeout'));
61
+ }, 10000);
62
+
62
63
  this.on('worker:connect_result', handleConnectResult);
63
64
 
64
65
  this.worker.postMessage({
@@ -73,10 +74,6 @@ class Iot {
73
74
  this.log('iot disconnect');
74
75
  this.stopCredentialsExpirationCheck();
75
76
  return new Promise((resolve, reject) => {
76
- const timeoutId = setTimeout(() => {
77
- this.off('worker:disconnect_result');
78
- reject(new Error('Disconnect timeout'));
79
- }, 5000);
80
77
 
81
78
  const handleDisconnectResult = (event) => {
82
79
  clearTimeout(timeoutId);
@@ -87,6 +84,12 @@ class Iot {
87
84
  reject(new Error(event.error));
88
85
  }
89
86
  };
87
+
88
+ const timeoutId = setTimeout(() => {
89
+ this.off('worker:disconnect_result', handleDisconnectResult);
90
+ reject(new Error('Disconnect timeout'));
91
+ }, 5000);
92
+
90
93
  this.on('worker:disconnect_result', handleDisconnectResult);
91
94
  this.worker.postMessage({ type: 'disconnect' });
92
95
  });