Explorar el Código

修复运维中心中开启历史日志后再开启实时日志连接失败

648540858 hace 11 meses
padre
commit
2c4311b58c

+ 0 - 3
src/main/java/com/genersoft/iot/vmp/conf/webLog/LogChannel.java

@@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j;
 import javax.websocket.*;
 import javax.websocket.server.ServerEndpoint;
 import java.io.IOException;
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -31,7 +30,6 @@ public class LogChannel {
     public void onOpen(Session session, EndpointConfig endpointConfig) {
         this.session = session;
         this.session.setMaxIdleTimeout(0);
-        System.out.println();
         CHANNELS.put(this.session.getId(), this);
 
         log.info("[Web-Log] 连接已建立: id={}", this.session.getId());
@@ -41,7 +39,6 @@ public class LogChannel {
     public void onClose(CloseReason closeReason) {
 
         log.info("[Web-Log] 连接已断开: id={}, err={}", this.session.getId(), closeReason);
-
         CHANNELS.remove(this.session.getId());
     }
 

+ 7 - 1
web_src/src/components/dialog/operationsFoShowLog.vue

@@ -32,6 +32,7 @@ export default {
       filter: "",
       logData: "",
       websocket: null,
+      destroyedCallback: null
     };
   },
   watch: {
@@ -61,7 +62,9 @@ export default {
   },
   destroyed() {
     console.log('destroyed');
-    window.websocket.close();
+    if (this.destroyedCallback) {
+      this.destroyedCallback()
+    }
   },
   methods: {
     initData: function () {
@@ -101,6 +104,9 @@ export default {
         }
         window.websocket.onopen = e => {
           console.log(`conn open: ${e}`);
+          this.destroyedCallback = ()=>{
+            window.websocket.close()
+          }
         }
       }
     },

+ 1 - 1
web_src/src/components/operationsForRealLog.vue

@@ -18,8 +18,8 @@ export default {
       winHeight: window.innerHeight - 220,
     };
   },
-
   created() {
+    console.log("removeUrl11 == " + this.removeUrl)
   },
   methods: {
     getURl: function () {