@hocuspocus/provider 3.2.1 → 3.2.3

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.
@@ -1232,6 +1232,7 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1232
1232
  this.messageQueue = [];
1233
1233
  this.configuration = {
1234
1234
  url: "",
1235
+ autoConnect: true,
1235
1236
  // @ts-ignore
1236
1237
  document: undefined,
1237
1238
  WebSocketPolyfill: undefined,
@@ -1296,10 +1297,9 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1296
1297
  this.on("close", this.onClose.bind(this));
1297
1298
  this.on("message", this.onMessage.bind(this));
1298
1299
  this.intervals.connectionChecker = setInterval(this.checkConnection.bind(this), this.configuration.messageReconnectTimeout / 10);
1299
- if (!this.shouldConnect) {
1300
- return;
1300
+ if (this.shouldConnect) {
1301
+ this.connect();
1301
1302
  }
1302
- this.connect();
1303
1303
  }
1304
1304
  async onOpen(event) {
1305
1305
  this.status = exports.WebSocketStatus.Connected;
@@ -1326,6 +1326,9 @@ class HocuspocusProviderWebsocket extends EventEmitter {
1326
1326
  }
1327
1327
  setConfiguration(configuration = {}) {
1328
1328
  this.configuration = { ...this.configuration, ...configuration };
1329
+ if (!this.configuration.autoConnect) {
1330
+ this.shouldConnect = false;
1331
+ }
1329
1332
  }
1330
1333
  async connect() {
1331
1334
  if (this.status === exports.WebSocketStatus.Connected) {