@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.
@@ -1896,14 +1896,15 @@ class HocuspocusProvider extends EventEmitter {
1896
1896
  createWebSocketConnection() {
1897
1897
  return new Promise((resolve, reject) => {
1898
1898
  // Init the WebSocket connection
1899
- this.webSocket = new this.options.WebSocketPolyfill(this.url);
1900
- this.webSocket.binaryType = 'arraybuffer';
1901
- this.webSocket.onmessage = this.onMessage.bind(this);
1902
- this.webSocket.onclose = this.onClose.bind(this);
1903
- this.webSocket.onopen = this.onOpen.bind(this);
1904
- this.webSocket.onerror = () => {
1899
+ const ws = new this.options.WebSocketPolyfill(this.url);
1900
+ ws.binaryType = 'arraybuffer';
1901
+ ws.onmessage = this.onMessage.bind(this);
1902
+ ws.onclose = this.onClose.bind(this);
1903
+ ws.onopen = this.onOpen.bind(this);
1904
+ ws.onerror = () => {
1905
1905
  reject();
1906
1906
  };
1907
+ this.webSocket = ws;
1907
1908
  // Reset the status
1908
1909
  this.synced = false;
1909
1910
  this.status = WebSocketStatus.Connecting;
@@ -1932,6 +1933,7 @@ class HocuspocusProvider extends EventEmitter {
1932
1933
  return this.options.awareness;
1933
1934
  }
1934
1935
  checkConnection() {
1936
+ var _a;
1935
1937
  // Don’t check the connection when it’s not even established
1936
1938
  if (this.status !== WebSocketStatus.Connected) {
1937
1939
  return;
@@ -1946,7 +1948,7 @@ class HocuspocusProvider extends EventEmitter {
1946
1948
  }
1947
1949
  // No message received in a long time, not even your own
1948
1950
  // Awareness updates, which are updated every 15 seconds.
1949
- this.webSocket.close();
1951
+ (_a = this.webSocket) === null || _a === void 0 ? void 0 : _a.close();
1950
1952
  }
1951
1953
  forceSync() {
1952
1954
  if (!this.webSocket) {