@hocuspocus/provider 1.0.0-alpha.20 → 1.0.0-alpha.24

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.
@@ -1909,11 +1909,11 @@ class HocuspocusProvider extends EventEmitter {
1909
1909
  },
1910
1910
  });
1911
1911
  }
1912
- catch (err) {
1913
- // If we aborted the connection attempt then don't throw an error
1912
+ catch (error) {
1913
+ // If we aborted the connection attempt then dont throw an error
1914
1914
  // ref: https://github.com/lifeomic/attempt/blob/master/src/index.ts#L136
1915
- if (err.code !== 'ATTEMPT_ABORTED') {
1916
- throw err;
1915
+ if (error && error.code !== 'ATTEMPT_ABORTED') {
1916
+ throw error;
1917
1917
  }
1918
1918
  }
1919
1919
  }
@@ -2073,7 +2073,6 @@ class HocuspocusProvider extends EventEmitter {
2073
2073
  return;
2074
2074
  }
2075
2075
  this.startSync();
2076
- this.resolveConnectionAttempt();
2077
2076
  }
2078
2077
  startSync() {
2079
2078
  this.send(SyncStepOneMessage, { document: this.document });
@@ -2095,6 +2094,7 @@ class HocuspocusProvider extends EventEmitter {
2095
2094
  }
2096
2095
  }
2097
2096
  onMessage(event) {
2097
+ this.resolveConnectionAttempt();
2098
2098
  this.lastMessageReceived = getUnixTime();
2099
2099
  const message = new IncomingMessage(event.data);
2100
2100
  this.emit('message', { event, message });