From f02ed3474fc16e6afe789b5fa78e008572df7019 Mon Sep 17 00:00:00 2001 From: lijie Date: Sun, 26 Jun 2022 23:50:49 +0800 Subject: [PATCH] Improve the judgment condition of WS connection status in resync scenario --- src/y-websocket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y-websocket.js b/src/y-websocket.js index da88c1e..8587bc7 100644 --- a/src/y-websocket.js +++ b/src/y-websocket.js @@ -238,7 +238,7 @@ export class WebsocketProvider extends Observable { this._resyncInterval = 0 if (resyncInterval > 0) { this._resyncInterval = /** @type {any} */ (setInterval(() => { - if (this.ws) { + if (this.ws && this.ws.readyState === WebSocket.OPEN) { // resend sync step 1 const encoder = encoding.createEncoder() encoding.writeVarUint(encoder, messageSync)