@hocuspocus/provider 2.7.1 → 2.8.0

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.
@@ -1700,14 +1700,12 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1700
1700
  quiet: false,
1701
1701
  providerMap: new Map(),
1702
1702
  };
1703
- this.subscribedToBroadcastChannel = false;
1704
1703
  this.webSocket = null;
1705
1704
  this.webSocketHandlers = {};
1706
1705
  this.shouldConnect = true;
1707
1706
  this.status = WebSocketStatus.Disconnected;
1708
1707
  this.lastMessageReceived = 0;
1709
1708
  this.identifier = 0;
1710
- this.mux = createMutex();
1711
1709
  this.intervals = {
1712
1710
  forceSync: null,
1713
1711
  connectionChecker: null,
@@ -1715,7 +1713,6 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1715
1713
  this.connectionAttempt = null;
1716
1714
  this.receivedOnOpenPayload = undefined;
1717
1715
  this.receivedOnStatusPayload = undefined;
1718
- this.boundConnect = this.connect.bind(this);
1719
1716
  this.closeTries = 0;
1720
1717
  this.setConfiguration(configuration);
1721
1718
  this.configuration.WebSocketPolyfill = configuration.WebSocketPolyfill
@@ -2599,12 +2596,14 @@ class HocuspocusProvider extends EventEmitter {
2599
2596
  disconnect() {
2600
2597
  this.disconnectBroadcastChannel();
2601
2598
  this.configuration.websocketProvider.detach(this);
2599
+ this.isConnected = false;
2602
2600
  if (!this.configuration.preserveConnection) {
2603
2601
  this.configuration.websocketProvider.disconnect();
2604
2602
  }
2605
2603
  }
2606
2604
  async onOpen(event) {
2607
2605
  this.isAuthenticated = false;
2606
+ this.isConnected = true;
2608
2607
  this.emit('open', { event });
2609
2608
  let token;
2610
2609
  try {
@@ -2675,7 +2674,6 @@ class HocuspocusProvider extends EventEmitter {
2675
2674
  if (this.awareness) {
2676
2675
  removeAwarenessStates(this.awareness, [this.document.clientID], 'provider destroy');
2677
2676
  }
2678
- this.disconnect();
2679
2677
  (_a = this.awareness) === null || _a === void 0 ? void 0 : _a.off('update', this.awarenessUpdateHandler);
2680
2678
  this.document.off('update', this.documentUpdateHandler);
2681
2679
  this.removeAllListeners();
@@ -2692,7 +2690,7 @@ class HocuspocusProvider extends EventEmitter {
2692
2690
  this.configuration.websocketProvider.off('destroy', this.configuration.onDestroy);
2693
2691
  this.configuration.websocketProvider.off('destroy', this.forwardDestroy);
2694
2692
  this.send(CloseMessage, { documentName: this.configuration.name });
2695
- this.isConnected = false;
2693
+ this.disconnect();
2696
2694
  if (typeof window === 'undefined') {
2697
2695
  return;
2698
2696
  }