@reactoo/watchtogether-sdk-js 2.7.44 → 2.7.45

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.44",
3
+ "version": "2.7.45",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
package/src/models/iot.js CHANGED
@@ -150,7 +150,7 @@ let iot = function () {
150
150
  this.iot.disableKeepAliveInterval();
151
151
 
152
152
  return this.__privates.iot.disconnect()
153
- .then(() => {
153
+ .finally(() => {
154
154
  this.iot.$off('connect', this.iot.onConnect, this);
155
155
  this.iot.$off('closed', this.iot.onClosed, this);
156
156
  this.iot.$off('error', this.iot.onError, this);
@@ -160,7 +160,6 @@ let iot = function () {
160
160
  this.iot.$off('connection_success', this.iot.onConnectionSuccess, this);
161
161
  this.iot.$off('connection_failure', this.iot.onConnectionFailure, this);
162
162
  this.iot.$off('updateCredentials', this.iot.__updateCredentials, this);
163
-
164
163
  this.iot.__promise = null;
165
164
  return true;
166
165
  });
@@ -246,6 +245,7 @@ let iot = function () {
246
245
  .catch(error => {
247
246
 
248
247
  if(error?.cause === -1) {
248
+ this.__privates.iot.log("We don't have a topic to check connection with");
249
249
  return;
250
250
  }
251
251
 
@@ -27,6 +27,10 @@ class Iot {
27
27
  connect(apiMqttUrl, apiMqttClientId, region, accessKeyId, secretAccessKey, sessionToken, expiration) {
28
28
  this.log('iot connect called, we disconnect first just to be sure');
29
29
  return this.disconnect()
30
+ .catch(() => {
31
+ // we dont care if disconnect fails
32
+ return Promise.resolve();
33
+ })
30
34
  .finally(() => {
31
35
  this.log('iot connect');
32
36
  this.startCredentialsExpirationCheck(expiration);
@@ -87,7 +91,7 @@ class Iot {
87
91
  return new Promise((resolve, reject) => {
88
92
  const timeoutId = setTimeout(() => {
89
93
  reject(new Error('Connection timeout'));
90
- }, 10000); // 10 seconds timeout is enough
94
+ }, 5000); // 5 seconds timeout is enough
91
95
  this.connection.connect()
92
96
  .then((r) => {
93
97
  clearTimeout(timeoutId);
@@ -109,7 +113,7 @@ class Iot {
109
113
  return new Promise((resolve, reject) => {
110
114
  const timeoutId = setTimeout(() => {
111
115
  reject(new Error('Disconnect timeout'));
112
- }, 10000); // 10 seconds timeout is enough
116
+ }, 5); // 5 seconds timeout is enough
113
117
  this.connection.disconnect()
114
118
  .then((r) => {
115
119
  clearTimeout(timeoutId);