Răsfoiți Sursa

Merge branch 'tmp' into develop

scorpio 2 ani în urmă
părinte
comite
c039c640a9
1 a modificat fișierele cu 4 adăugiri și 3 ștergeri
  1. 4 3
      src/layout/top.vue

+ 4 - 3
src/layout/top.vue

@@ -161,7 +161,7 @@ export default {
         this.mini = false
       }
     })
-    // this.initWebSocket()
+    this.initWebSocket()
   },
   mounted() {
     this.initWebSocket()
@@ -184,6 +184,7 @@ export default {
     websocketonopen() {
       // 开启心跳
       this.start()
+
       // 连接建立之后执行send方法发送数据
       // const actions = {
       //   room: '007854ce7b93476487c7ca8826d17eba',
@@ -254,14 +255,14 @@ export default {
         console.log(self.websock)
         if (self.websock.readyState === 1) {
           // 如果连接正常
-          // self.ws.send("heartCheck"); //这里可以自己跟后端约定
+          self.websock.send('heartCheck') // 这里可以自己跟后端约定
         } else {
           // 否则重连
           self.reconnect()
         }
         self.serverTimeoutObj = setTimeout(function () {
           // 超时关闭
-          self.ws.close()
+          self.websock.close()
         }, self.timeout)
       }, self.timeout)
     },