From 110a1bfa00210b0efe79a5a81cee5529f5c8ea9c Mon Sep 17 00:00:00 2001 From: soul-walker Date: Sat, 11 May 2024 10:36:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=EF=BC=9Arts-sim-testing-c?= =?UTF-8?q?lient=E7=9A=84#2issue:=20https://gitea.joylink.club/joylink/rts?= =?UTF-8?q?-sim-testing-client/issues/2#issue-17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/message/MqttBroker.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/message/MqttBroker.ts b/src/message/MqttBroker.ts index f79c70f..990ee26 100644 --- a/src/message/MqttBroker.ts +++ b/src/message/MqttBroker.ts @@ -85,12 +85,14 @@ export class MqttMsgClient extends MessageClient { } unsubscribe0(destination: string): void { console.debug('MQTT取消订阅执行', destination); + // 删除指定订阅的消息处理器 + this.subMsgHandler.delete(destination); + // 通知服务器取消订阅 this.cli.unsubscribe(destination, (error, packet) => { if (error) { console.warn('MQTT 取消订阅失败', error); } else { console.debug('MQTT 取消订阅成功', packet); - this.subMsgHandler.delete(destination); } }); }