This commit is contained in:
张成
2026-04-10 18:45:10 +08:00
parent 37daa2f99f
commit 7ef0c68ad1
4 changed files with 139 additions and 24 deletions

View File

@@ -141,6 +141,11 @@ class ScheduleManager {
console.error('[调度管理器] 处理 Boss 消息失败:', error);
}
});
// 重连后向 Broker 幂等声明订阅(监听器仅在上方注册一次,不重复添加)
if (typeof this.mqttClient.setMaintainedTopics === 'function') {
this.mqttClient.setMaintainedTopics(['heartbeat', 'response', 'boss/message']);
}
}
@@ -152,7 +157,11 @@ class ScheduleManager {
const status = this.mqttDispatcher ? this.mqttDispatcher.getSystemStatus() : {};
return {
isInitialized: this.isInitialized,
mqttConnected: this.mqttClient && this.mqttClient.isConnected,
mqttConnected: this.mqttClient && (
typeof this.mqttClient.isBrokerConnected === 'function'
? this.mqttClient.isBrokerConnected()
: this.mqttClient.isConnected
),
systemStats: deviceManager.getSystemStats(),
allDevices: deviceManager.getAllDevicesStatus(),
taskQueues: TaskQueue.getAllDeviceStatus(),