@hocuspocus/provider 3.2.2 → 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.
- package/dist/hocuspocus-provider.cjs +6 -3
- package/dist/hocuspocus-provider.cjs.map +1 -1
- package/dist/hocuspocus-provider.esm.js +6 -3
- package/dist/hocuspocus-provider.esm.js.map +1 -1
- package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +6 -1
- package/package.json +2 -2
- package/src/HocuspocusProviderWebsocket.ts +14 -5
|
@@ -1211,6 +1211,7 @@ class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
1211
1211
|
this.messageQueue = [];
|
|
1212
1212
|
this.configuration = {
|
|
1213
1213
|
url: "",
|
|
1214
|
+
autoConnect: true,
|
|
1214
1215
|
// @ts-ignore
|
|
1215
1216
|
document: undefined,
|
|
1216
1217
|
WebSocketPolyfill: undefined,
|
|
@@ -1275,10 +1276,9 @@ class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
1275
1276
|
this.on("close", this.onClose.bind(this));
|
|
1276
1277
|
this.on("message", this.onMessage.bind(this));
|
|
1277
1278
|
this.intervals.connectionChecker = setInterval(this.checkConnection.bind(this), this.configuration.messageReconnectTimeout / 10);
|
|
1278
|
-
if (
|
|
1279
|
-
|
|
1279
|
+
if (this.shouldConnect) {
|
|
1280
|
+
this.connect();
|
|
1280
1281
|
}
|
|
1281
|
-
this.connect();
|
|
1282
1282
|
}
|
|
1283
1283
|
async onOpen(event) {
|
|
1284
1284
|
this.status = WebSocketStatus.Connected;
|
|
@@ -1305,6 +1305,9 @@ class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
setConfiguration(configuration = {}) {
|
|
1307
1307
|
this.configuration = { ...this.configuration, ...configuration };
|
|
1308
|
+
if (!this.configuration.autoConnect) {
|
|
1309
|
+
this.shouldConnect = false;
|
|
1310
|
+
}
|
|
1308
1311
|
}
|
|
1309
1312
|
async connect() {
|
|
1310
1313
|
if (this.status === WebSocketStatus.Connected) {
|