@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.
- package/dist/demos/backend/src/{create-document.d.ts → load-document.d.ts} +0 -0
- package/dist/hocuspocus-provider.cjs +9 -7
- package/dist/hocuspocus-provider.cjs.map +1 -1
- package/dist/hocuspocus-provider.esm.js +9 -7
- package/dist/hocuspocus-provider.esm.js.map +1 -1
- package/dist/packages/extension-logger/src/Logger.d.ts +68 -0
- package/dist/packages/extension-logger/src/index.d.ts +1 -0
- package/dist/packages/{monitor → extension-monitor}/src/Collector.d.ts +2 -2
- package/dist/packages/{monitor → extension-monitor}/src/Dashboard.d.ts +2 -2
- package/dist/packages/{monitor → extension-monitor}/src/Storage.d.ts +0 -0
- package/dist/packages/{monitor → extension-monitor}/src/index.d.ts +2 -2
- package/dist/packages/{redis → extension-redis}/src/Redis.d.ts +2 -2
- package/dist/packages/{redis → extension-redis}/src/RedisCluster.d.ts +0 -0
- package/dist/packages/{redis → extension-redis}/src/index.d.ts +0 -0
- package/dist/packages/{rocksdb → extension-rocksdb}/src/index.d.ts +3 -3
- package/dist/packages/{throttle → extension-throttle}/src/index.d.ts +0 -0
- package/dist/packages/{webhook → extension-webhook}/src/index.d.ts +4 -4
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +4 -4
- package/dist/packages/server/src/Hocuspocus.d.ts +3 -2
- package/dist/packages/server/src/types.d.ts +10 -2
- package/package.json +10 -5
- package/src/HocuspocusProvider.ts +12 -11
- package/dist/packages/logger/src/index.d.ts +0 -13
|
@@ -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
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
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) {
|