|
@@ -141,7 +141,7 @@ const handleMqttMessageFromDetector = (message: MqttMessage) => {
|
|
const startListening = () => {
|
|
const startListening = () => {
|
|
mqttClient = mqtt.connect(MQTT_BROKER_URL, options);
|
|
mqttClient = mqtt.connect(MQTT_BROKER_URL, options);
|
|
mqttClient.on('connect', () => {
|
|
mqttClient.on('connect', () => {
|
|
- console.log('[mqttServiceForDevice] Connected to MQTT broker');
|
|
|
|
|
|
+ console.log(`[mqttServiceForDevice] Connected to MQTT broker 目标borker 是: ${MQTT_BROKER_URL}`);
|
|
mqttClient.subscribe(MQTT_TOPIC, (err) => {
|
|
mqttClient.subscribe(MQTT_TOPIC, (err) => {
|
|
if (err) {
|
|
if (err) {
|
|
console.error(
|
|
console.error(
|
|
@@ -219,7 +219,7 @@ const startListening = () => {
|
|
});
|
|
});
|
|
|
|
|
|
mqttClient.on('error', (error) => {
|
|
mqttClient.on('error', (error) => {
|
|
- console.log('[mqttServiceForDevice] Connection failed:', error);
|
|
|
|
|
|
+ console.log('[mqttServiceForDevice] 设备mqtt出现错误:', JSON.stringify(error));
|
|
});
|
|
});
|
|
|
|
|
|
mqttClient.on('message', (topic, message) => {
|
|
mqttClient.on('message', (topic, message) => {
|