@hocuspocus/provider 2.3.0 → 2.3.1
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 +17 -2
- package/dist/hocuspocus-provider.cjs.map +1 -1
- package/dist/hocuspocus-provider.esm.js +17 -2
- package/dist/hocuspocus-provider.esm.js.map +1 -1
- package/dist/packages/provider/src/HocuspocusProviderWebsocket.d.ts +1 -0
- package/dist/packages/provider/src/types.d.ts +2 -1
- package/package.json +2 -2
- package/src/HocuspocusProviderWebsocket.ts +18 -2
- package/src/types.ts +2 -1
|
@@ -1669,6 +1669,7 @@ class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
1669
1669
|
this.receivedOnOpenPayload = undefined;
|
|
1670
1670
|
this.receivedOnStatusPayload = undefined;
|
|
1671
1671
|
this.boundConnect = this.connect.bind(this);
|
|
1672
|
+
this.closeTries = 0;
|
|
1672
1673
|
this.setConfiguration(configuration);
|
|
1673
1674
|
this.configuration.WebSocketPolyfill = configuration.WebSocketPolyfill ? configuration.WebSocketPolyfill : WebSocket;
|
|
1674
1675
|
this.on('open', this.configuration.onOpen);
|
|
@@ -1830,8 +1831,21 @@ class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
1830
1831
|
}
|
|
1831
1832
|
// No message received in a long time, not even your own
|
|
1832
1833
|
// Awareness updates, which are updated every 15 seconds.
|
|
1833
|
-
|
|
1834
|
-
|
|
1834
|
+
this.closeTries += 1;
|
|
1835
|
+
// https://bugs.webkit.org/show_bug.cgi?id=247943
|
|
1836
|
+
if (this.closeTries > 2) {
|
|
1837
|
+
this.onClose({
|
|
1838
|
+
event: {
|
|
1839
|
+
code: 4408,
|
|
1840
|
+
reason: 'forced',
|
|
1841
|
+
},
|
|
1842
|
+
});
|
|
1843
|
+
this.closeTries = 0;
|
|
1844
|
+
}
|
|
1845
|
+
else {
|
|
1846
|
+
(_a = this.webSocket) === null || _a === void 0 ? void 0 : _a.close();
|
|
1847
|
+
this.messageQueue = [];
|
|
1848
|
+
}
|
|
1835
1849
|
}
|
|
1836
1850
|
registerEventListeners() {
|
|
1837
1851
|
if (typeof window === 'undefined') {
|
|
@@ -1873,6 +1887,7 @@ class HocuspocusProviderWebsocket extends EventEmitter {
|
|
|
1873
1887
|
}
|
|
1874
1888
|
}
|
|
1875
1889
|
onClose({ event }) {
|
|
1890
|
+
this.closeTries = 0;
|
|
1876
1891
|
this.webSocket = null;
|
|
1877
1892
|
if (this.status === WebSocketStatus.Connected) {
|
|
1878
1893
|
this.status = WebSocketStatus.Disconnected;
|