修复bug:rts-sim-testing-client的#2issue: joylink/rts-sim-testing-client#2 (comment)

This commit is contained in:
soul-walker 2024-05-11 10:36:18 +08:00
parent baa468200a
commit 110a1bfa00

View File

@ -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);
}
});
}