MQTT添加消息日志
This commit is contained in:
parent
110a1bfa00
commit
b29036144b
@ -52,6 +52,7 @@ export class MqttMsgClient extends MessageClient {
|
||||
this.emit('error', error);
|
||||
});
|
||||
this.cli.on('message', (topic, message) => {
|
||||
console.debug('MQTT 收到消息', topic, message);
|
||||
const handle = this.subMsgHandler.get(topic);
|
||||
if (handle) {
|
||||
if (this.options.protocol === 'json') {
|
||||
@ -61,6 +62,8 @@ export class MqttMsgClient extends MessageClient {
|
||||
// 字节流
|
||||
handle(message);
|
||||
}
|
||||
} else {
|
||||
console.warn('未找到订阅的消息处理器', topic);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user