Browse Source

Merge branch 'mqtt逻辑处理' of sckj/mz-cloud into master

sckj 1 week ago
parent
commit
b6c24f5910
1 changed files with 6 additions and 6 deletions
  1. 6 6
      ruoyi-ui-gljt/src/views/gljt/gljtSq/index.vue

+ 6 - 6
ruoyi-ui-gljt/src/views/gljt/gljtSq/index.vue

@@ -1931,18 +1931,18 @@ export default {
       // 连接错误处理
       this.client.on("error", (error) => {
         this.isMqtt=false;
+        if (this.client) {
+          this.client.end();
+        }
         console.log("连接出错: ", error);
       });
       // 重新连接处理
-      // this.client.on('reconnect', () => {
-      //   console.log('重新连接...')
-      // })
+      this.client.on('reconnect', () => {
+        console.log('重新连接...')
+      })
       this.client.on("close", () => {
         console.log("监听断开连接");
         this.isMqtt=false;
-        if (this.client) {
-          this.client.end();
-        }
       });
     },
     endTime() {