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