scorpio 2 年之前
父節點
當前提交
9c62ccbdda
共有 1 個文件被更改,包括 15 次插入16 次删除
  1. 15 16
      src/layout/top.vue

+ 15 - 16
src/layout/top.vue

@@ -268,22 +268,21 @@ export default {
       const self = this
       self.timeoutObj && clearTimeout(self.timeoutObj)
       self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj)
-      self.timeoutObj = setTimeout(function () {
-        // 这里发送一个心跳,后端收到后,返回一个心跳消息,
-        console.log(self.websock)
-        if (self.websock.readyState === 1) {
-          // 如果连接正常
-          self.websock.send('heartCheck') // 这里可以自己跟后端约定
-        } else {
-          // 否则重连
-          this.websock.close()
-          self.reconnect()
-        }
-        self.serverTimeoutObj = setTimeout(function () {
-          // 超时关闭
-          self.websock.close()
-        }, self.timeout)
-      }, self.timeout)
+      // self.timeoutObj = setTimeout(function () {
+      //   // 这里发送一个心跳,后端收到后,返回一个心跳消息,
+      //   console.log(self.websock)
+      //   if (self.websock.readyState === 1) {
+      //     // 如果连接正常
+      //     self.websock.send('heartCheck') // 这里可以自己跟后端约定
+      //   } else {
+      //     // 否则重连
+      //     // self.reconnect()
+      //   }
+      //   self.serverTimeoutObj = setTimeout(function () {
+      //     // 超时关闭
+      //     self.websock.close()
+      //   }, self.timeout)
+      // }, self.timeout)
     },
 
     dropDown(res) {