From 60aa0e1611030f03d2c649f5b9f99f4974c7b545 Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 12 May 2022 22:59:47 +0800 Subject: [PATCH] ui: fix connection close --- packages/ui-default/components/socket/index.js | 4 +--- packages/ui-default/package.json | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/ui-default/components/socket/index.js b/packages/ui-default/components/socket/index.js index 52208e113..6bb9b0e3b 100644 --- a/packages/ui-default/components/socket/index.js +++ b/packages/ui-default/components/socket/index.js @@ -5,7 +5,6 @@ export default class Sock { const i = new URL(url, window.location.href); i.protocol = i.protocol.replace('http', 'ws'); this.url = i.toString(); - this.closed = false; this.sock = new ReconnectingWebSocket(this.url); this.sock.onopen = () => { console.log('Connected'); @@ -13,7 +12,7 @@ export default class Sock { }; this.sock.onclose = ({ code, reason }) => { console.warn('Connection closed, ', code, reason); - if (code >= 4000) this.closed = true; + if (code >= 4000) this.close(); this.onclose?.(code, reason); }; this.sock.onmessage = (message) => { @@ -29,7 +28,6 @@ export default class Sock { } close() { - this.closed = true; this.sock?.close?.(); } } diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index 76e89b92e..f79bb29ed 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/ui-default", - "version": "4.37.1", + "version": "4.37.2", "author": "undefined ", "license": "AGPL-3.0", "main": "hydro.js",