设备列表取消订阅

This commit is contained in:
kerwincui
2022-05-12 14:25:42 +08:00
parent cd63e1eba4
commit bc694b8a6f
2 changed files with 21 additions and 19 deletions

View File

@@ -392,12 +392,13 @@ export default {
mqttSubscribe(list) {
// 订阅当前页面设备状态和实时监测
let topics = [];
for (let i = 0; i < list.length; i++) {
let topicStatus = "/" + list[i].productId + "/" + list[i].serialNumber + "/status/post";
let topicMonitor = "/" + list[i].productId + "/" + list[i].serialNumber + "/monitor/post";
topics.push(topicStatus);
topics.push(topicMonitor);
}
// 订阅数太多会导致emqx连接中断或者订阅缓慢
// for (let i = 0; i < list.length; i++) {
// let topicStatus = "/" + list[i].productId + "/" + list[i].serialNumber + "/status/post";
// let topicMonitor = "/" + list[i].productId + "/" + list[i].serialNumber + "/monitor/post";
// topics.push(topicStatus);
// topics.push(topicMonitor);
// }
this.subscribes = topics;
},
/** 更新实时监测参数*/