@reactoo/watchtogether-sdk-js 2.7.36 → 2.7.38-beta.1

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.
@@ -16710,13 +16710,17 @@ let iot = function () {
16710
16710
  let visibilityChangeHandler = null;
16711
16711
  let keepAliveIntervalId = null;
16712
16712
  let shouldBeConnected = false;
16713
+ let isReconnecting = false;
16713
16714
  return {
16714
16715
  __promise: null,
16715
16716
  __updateCredentials: () => {
16717
+ isReconnecting = true;
16716
16718
  return this.iot.getCredentials().then(response => this.__privates.iot.updateWebSocketCredentials(response.data.credentials.accessKeyId, response.data.credentials.secretAccessKey, response.data.credentials.sessionToken, response.data.credentials.expiration)).catch(error => {
16717
16719
  this.__privates.iot.log('Failed to update credentials:', error);
16718
16720
  // Let the error propagate to be handled by the Iot class
16719
16721
  throw error;
16722
+ }).finally(() => {
16723
+ isReconnecting = false;
16720
16724
  });
16721
16725
  },
16722
16726
  getCredentials: () => {
@@ -16732,7 +16736,7 @@ let iot = function () {
16732
16736
  },
16733
16737
  onClosed: () => {
16734
16738
  this.__privates.iot.log('MQTT client closed');
16735
- if (shouldBeConnected) {
16739
+ if (shouldBeConnected && !isReconnecting) {
16736
16740
  this.iot.__updateCredentials();
16737
16741
  }
16738
16742
  },
@@ -25461,7 +25465,10 @@ class Iot {
25461
25465
  expiration
25462
25466
  };
25463
25467
  const currentTopics = new Set(this.subscribedTopics);
25464
- return this.disconnect().then(() => this.connect(this.lastConnectParams.apiMqttUrl, this.lastConnectParams.apiMqttClientId, this.lastConnectParams.region, accessKeyId, secretAccessKey, sessionToken, expiration)).then(() => {
25468
+
25469
+ // disconnect is part of connect process
25470
+
25471
+ return this.connect(this.lastConnectParams.apiMqttUrl, this.lastConnectParams.apiMqttClientId, this.lastConnectParams.region, accessKeyId, secretAccessKey, sessionToken, expiration).then(() => {
25465
25472
  // Resubscribe to topics
25466
25473
  currentTopics.forEach(topic => this.subscribe(topic));
25467
25474
  this.startCredentialsExpirationCheck(expiration);