From a50461d4e64d8cca4f15874b3101777bcbf017af Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 9 Sep 2023 23:54:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E8=BF=9E=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=E5=A4=AA=E5=A4=9A=E7=9A=84=E4=BF=9D=E9=99=A9=E6=8E=AA?= =?UTF-8?q?=E6=96=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blivedm | 2 +- frontend/src/api/chat/ChatClientDirectOpenLive.js | 9 +++++++++ frontend/src/api/chat/ChatClientDirectWeb.js | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/blivedm b/blivedm index 356837c..b1d066b 160000 --- a/blivedm +++ b/blivedm @@ -1 +1 @@ -Subproject commit 356837c136589b92fb2d9f2f26ad3ae1a338f39d +Subproject commit b1d066b59fabe106ce70a822e9f6e6ba29242519 diff --git a/frontend/src/api/chat/ChatClientDirectOpenLive.js b/frontend/src/api/chat/ChatClientDirectOpenLive.js index 6abfa3d..b14625f 100644 --- a/frontend/src/api/chat/ChatClientDirectOpenLive.js +++ b/frontend/src/api/chat/ChatClientDirectOpenLive.js @@ -122,6 +122,15 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase { return true } + async onBeforeWsConnect() { + // 重连次数太多则重新init_room,保险 + let reinitPeriod = Math.max(3, (this.hostServerUrlList || []).length) + if (this.retryCount > 0 && this.retryCount % reinitPeriod === 0) { + this.needInitRoom = true + } + return super.onBeforeWsConnect() + } + getWsUrl() { return this.hostServerUrlList[this.retryCount % this.hostServerUrlList.length] } diff --git a/frontend/src/api/chat/ChatClientDirectWeb.js b/frontend/src/api/chat/ChatClientDirectWeb.js index a890108..3ffc0d0 100644 --- a/frontend/src/api/chat/ChatClientDirectWeb.js +++ b/frontend/src/api/chat/ChatClientDirectWeb.js @@ -35,6 +35,15 @@ export default class ChatClientDirectWeb extends ChatClientOfficialBase { return true } + async onBeforeWsConnect() { + // 重连次数太多则重新init_room,保险 + let reinitPeriod = Math.max(3, (this.hostServerList || []).length) + if (this.retryCount > 0 && this.retryCount % reinitPeriod === 0) { + this.needInitRoom = true + } + return super.onBeforeWsConnect() + } + getWsUrl() { let hostServer = this.hostServerList[this.retryCount % this.hostServerList.length] return `wss://${hostServer.host}:${hostServer.wss_port}/sub`