From 7f77fdd889fca2d16b57ae561a6e6e32c6e32ff4 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 8 Dec 2024 19:42:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E5=BC=80=E6=94=BE=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=81=9C=E6=AD=A2=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E7=9A=84=E6=B6=88=E6=81=AF=EF=BC=8C=E5=8F=8A=E6=97=B6?= =?UTF-8?q?=E6=96=AD=E5=BC=80=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blivedm | 2 +- .../src/api/chat/ChatClientDirectOpenLive.js | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/blivedm b/blivedm index 7f400e9..f9b6dc2 160000 --- a/blivedm +++ b/blivedm @@ -1 +1 @@ -Subproject commit 7f400e9c61d449a0e4212b47f45f0d1e4215157c +Subproject commit f9b6dc2f353f574dc7ae757be63ccacf6c93d06f diff --git a/frontend/src/api/chat/ChatClientDirectOpenLive.js b/frontend/src/api/chat/ChatClientDirectOpenLive.js index d16c422..f9c14d8 100644 --- a/frontend/src/api/chat/ChatClientDirectOpenLive.js +++ b/frontend/src/api/chat/ChatClientDirectOpenLive.js @@ -214,7 +214,20 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase { super.delayReconnect() } - async dmCallback(command) { + interactionEndCallback(command) { + if (command.data.game_id !== this.gameId) { + return + } + // 服务器主动停止推送,可能是心跳超时,需要重新开启项目 + console.error(`Open Live session end by server, gameId=${this.gameId}`) + this.addDebugMsg('Open Live session end by server') + + this.gameId = null + this.needInitRoom = true + this.discardWebsocket() + } + + dmCallback(command) { let data = command.data let authorType @@ -262,7 +275,7 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase { this.msgHandler.onAddGift(data) } - async guardCallback(command) { + guardCallback(command) { let data = command.data data = new chatModels.AddMemberMsg({ id: data.msg_id, @@ -298,6 +311,7 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase { } const CMD_CALLBACK_MAP = { + LIVE_OPEN_PLATFORM_INTERACTION_END: ChatClientDirectOpenLive.prototype.interactionEndCallback, LIVE_OPEN_PLATFORM_DM: ChatClientDirectOpenLive.prototype.dmCallback, LIVE_OPEN_PLATFORM_SEND_GIFT: ChatClientDirectOpenLive.prototype.sendGiftCallback, LIVE_OPEN_PLATFORM_GUARD: ChatClientDirectOpenLive.prototype.guardCallback,