@hocuspocus/provider
Advanced tools
Comparing version 1.0.0-alpha.19 to 1.0.0-alpha.20
@@ -1899,10 +1899,11 @@ import * as Y from 'yjs'; | ||
// Init the WebSocket connection | ||
this.webSocket = new this.options.WebSocketPolyfill(this.url); | ||
this.webSocket.binaryType = 'arraybuffer'; | ||
this.webSocket.onmessage = this.onMessage.bind(this); | ||
this.webSocket.onclose = this.onClose.bind(this); | ||
this.webSocket.onopen = this.onOpen.bind(this); | ||
this.webSocket.onerror = () => { | ||
const ws = new this.options.WebSocketPolyfill(this.url); | ||
ws.binaryType = 'arraybuffer'; | ||
ws.onmessage = this.onMessage.bind(this); | ||
ws.onclose = this.onClose.bind(this); | ||
ws.onopen = this.onOpen.bind(this); | ||
ws.onerror = () => { | ||
reject(); | ||
}; | ||
this.webSocket = ws; | ||
// Reset the status | ||
@@ -1936,2 +1937,3 @@ this.synced = false; | ||
checkConnection() { | ||
var _a; | ||
// Don’t check the connection when it’s not even established | ||
@@ -1951,3 +1953,3 @@ if (this.status !== WebSocketStatus.Connected) { | ||
// Awareness updates, which are updated every 15 seconds. | ||
this.webSocket.close(); | ||
(_a = this.webSocket) === null || _a === void 0 ? void 0 : _a.close(); | ||
} | ||
@@ -1954,0 +1956,0 @@ forceSync() { |
@@ -111,3 +111,3 @@ import * as Y from 'yjs'; | ||
subscribedToBroadcastChannel: boolean; | ||
webSocket: any; | ||
webSocket: WebSocket | null; | ||
shouldConnect: boolean; | ||
@@ -114,0 +114,0 @@ status: WebSocketStatus; |
{ | ||
"name": "@hocuspocus/provider", | ||
"version": "1.0.0-alpha.19", | ||
"version": "1.0.0-alpha.20", | ||
"description": "hocuspocus provider", | ||
@@ -31,3 +31,3 @@ "homepage": "https://hocuspocus.dev", | ||
}, | ||
"gitHead": "49a520f1b6be37139f5c7243a484dc413640869c", | ||
"gitHead": "d15359746b9d8e6518ef4128a033512ba0a893e6", | ||
"publishConfig": { | ||
@@ -34,0 +34,0 @@ "access": "public" |
@@ -170,3 +170,3 @@ import * as Y from 'yjs' | ||
webSocket: any = null | ||
webSocket: WebSocket | null = null | ||
@@ -291,10 +291,11 @@ shouldConnect = true | ||
// Init the WebSocket connection | ||
this.webSocket = new this.options.WebSocketPolyfill(this.url) | ||
this.webSocket.binaryType = 'arraybuffer' | ||
this.webSocket.onmessage = this.onMessage.bind(this) | ||
this.webSocket.onclose = this.onClose.bind(this) | ||
this.webSocket.onopen = this.onOpen.bind(this) | ||
this.webSocket.onerror = () => { | ||
const ws = new this.options.WebSocketPolyfill(this.url) | ||
ws.binaryType = 'arraybuffer' | ||
ws.onmessage = this.onMessage.bind(this) | ||
ws.onclose = this.onClose.bind(this) | ||
ws.onopen = this.onOpen.bind(this) | ||
ws.onerror = () => { | ||
reject() | ||
} | ||
this.webSocket = ws | ||
@@ -350,3 +351,3 @@ // Reset the status | ||
// Awareness updates, which are updated every 15 seconds. | ||
this.webSocket.close() | ||
this.webSocket?.close() | ||
} | ||
@@ -353,0 +354,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6044
532207