@hocuspocus/provider 1.0.0-alpha.18 → 1.0.0-alpha.22

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.
@@ -1920,14 +1920,15 @@ class HocuspocusProvider extends EventEmitter {
1920
1920
  createWebSocketConnection() {
1921
1921
  return new Promise((resolve, reject) => {
1922
1922
  // Init the WebSocket connection
1923
- this.webSocket = new this.options.WebSocketPolyfill(this.url);
1924
- this.webSocket.binaryType = 'arraybuffer';
1925
- this.webSocket.onmessage = this.onMessage.bind(this);
1926
- this.webSocket.onclose = this.onClose.bind(this);
1927
- this.webSocket.onopen = this.onOpen.bind(this);
1928
- this.webSocket.onerror = () => {
1923
+ const ws = new this.options.WebSocketPolyfill(this.url);
1924
+ ws.binaryType = 'arraybuffer';
1925
+ ws.onmessage = this.onMessage.bind(this);
1926
+ ws.onclose = this.onClose.bind(this);
1927
+ ws.onopen = this.onOpen.bind(this);
1928
+ ws.onerror = () => {
1929
1929
  reject();
1930
1930
  };
1931
+ this.webSocket = ws;
1931
1932
  // Reset the status
1932
1933
  this.synced = false;
1933
1934
  this.status = exports.WebSocketStatus.Connecting;
@@ -1956,6 +1957,7 @@ class HocuspocusProvider extends EventEmitter {
1956
1957
  return this.options.awareness;
1957
1958
  }
1958
1959
  checkConnection() {
1960
+ var _a;
1959
1961
  // Don’t check the connection when it’s not even established
1960
1962
  if (this.status !== exports.WebSocketStatus.Connected) {
1961
1963
  return;
@@ -1970,7 +1972,7 @@ class HocuspocusProvider extends EventEmitter {
1970
1972
  }
1971
1973
  // No message received in a long time, not even your own
1972
1974
  // Awareness updates, which are updated every 15 seconds.
1973
- this.webSocket.close();
1975
+ (_a = this.webSocket) === null || _a === void 0 ? void 0 : _a.close();
1974
1976
  }
1975
1977
  forceSync() {
1976
1978
  if (!this.webSocket) {