南昌市物联网技防平台-前端
zengh
2021-03-29 85769491b08c9bd8c9ac591285b0bb9dce79d14f
websocket断线重连
1 files modified
7 ■■■■ changed files
src/page/index/logo.vue 7 ●●●● patch | view | raw | blame | history
src/page/index/logo.vue
@@ -802,6 +802,9 @@
    //启动websocket
    websocketStart() {
      var that = this;
      if (!window.WebSocket) {
        window.WebSocket = window.MozWebSocket;
      }
@@ -843,7 +846,7 @@
              //断开连接,重连
              window.clearTimeout(window.websockPing);
              //执行重连
              this.websocketStart();
              that.websocketStart();
            }
@@ -851,7 +854,7 @@
        } else {
          console.log("WebSocket连接没有建立成功!!");
          //执行重连
          this.websocketStart();
          that.websocketStart();
        }
      }, 3000);
    },