@hocuspocus/provider 2.7.0 → 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.
@@ -1724,14 +1724,12 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1724
1724
  quiet: false,
1725
1725
  providerMap: new Map(),
1726
1726
  };
1727
- this.subscribedToBroadcastChannel = false;
1728
1727
  this.webSocket = null;
1729
1728
  this.webSocketHandlers = {};
1730
1729
  this.shouldConnect = true;
1731
1730
  this.status = exports.WebSocketStatus.Disconnected;
1732
1731
  this.lastMessageReceived = 0;
1733
1732
  this.identifier = 0;
1734
- this.mux = createMutex();
1735
1733
  this.intervals = {
1736
1734
  forceSync: null,
1737
1735
  connectionChecker: null,
@@ -1739,7 +1737,6 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1739
1737
  this.connectionAttempt = null;
1740
1738
  this.receivedOnOpenPayload = undefined;
1741
1739
  this.receivedOnStatusPayload = undefined;
1742
- this.boundConnect = this.connect.bind(this);
1743
1740
  this.closeTries = 0;
1744
1741
  this.setConfiguration(configuration);
1745
1742
  this.configuration.WebSocketPolyfill = configuration.WebSocketPolyfill
@@ -2623,12 +2620,14 @@ class HocuspocusProvider extends EventEmitter {
2623
2620
  disconnect() {
2624
2621
  this.disconnectBroadcastChannel();
2625
2622
  this.configuration.websocketProvider.detach(this);
2623
+ this.isConnected = false;
2626
2624
  if (!this.configuration.preserveConnection) {
2627
2625
  this.configuration.websocketProvider.disconnect();
2628
2626
  }
2629
2627
  }
2630
2628
  async onOpen(event) {
2631
2629
  this.isAuthenticated = false;
2630
+ this.isConnected = true;
2632
2631
  this.emit('open', { event });
2633
2632
  let token;
2634
2633
  try {
@@ -2699,7 +2698,6 @@ class HocuspocusProvider extends EventEmitter {
2699
2698
  if (this.awareness) {
2700
2699
  removeAwarenessStates(this.awareness, [this.document.clientID], 'provider destroy');
2701
2700
  }
2702
- this.disconnect();
2703
2701
  (_a = this.awareness) === null || _a === void 0 ? void 0 : _a.off('update', this.awarenessUpdateHandler);
2704
2702
  this.document.off('update', this.documentUpdateHandler);
2705
2703
  this.removeAllListeners();
@@ -2716,7 +2714,7 @@ class HocuspocusProvider extends EventEmitter {
2716
2714
  this.configuration.websocketProvider.off('destroy', this.configuration.onDestroy);
2717
2715
  this.configuration.websocketProvider.off('destroy', this.forwardDestroy);
2718
2716
  this.send(CloseMessage, { documentName: this.configuration.name });
2719
- this.isConnected = false;
2717
+ this.disconnect();
2720
2718
  if (typeof window === 'undefined') {
2721
2719
  return;
2722
2720
  }