mqtt架构修改

master
xce 2026-01-19 01:50:04 +08:00
parent 001ad6c071
commit 77a8a26ca9
2 changed files with 5 additions and 4 deletions

View File

@ -94,8 +94,8 @@ const user = {
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
batchUnsubscribe({clientId:mqttUtil.getMqttState().clientId}).then(response => {
if (response.code === 200) {
// batchUnsubscribe({clientId:mqttUtil.getMqttState().clientId}).then(response => {
// if (response.code === 200) {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
@ -107,8 +107,8 @@ const user = {
reject(error)
})
console.info("取消订阅成功!")
}
})
// }
// })
})
}
}

View File

@ -302,6 +302,7 @@ export function startMqttOnlinePing(intervalMs = 20000) {
const payload = JSON.stringify({ ts: Date.now() });
// qos=0 足够retain 不要
mqttState.client.publish(topic, payload, { qos: 0, retain: false });
console.info(`主题:${topic}${payload}`)
} catch (e) {}
};