mqtt架构修改
parent
001ad6c071
commit
77a8a26ca9
|
|
@ -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("取消订阅成功!")
|
||||
}
|
||||
})
|
||||
// }
|
||||
// })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue