see999 4 years ago
parent
commit
3aba79bd36
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/views/layout/components/Navbar.vue

+ 7 - 1
src/views/layout/components/Navbar.vue View File

305
               this.showWsErr = true;
305
               this.showWsErr = true;
306
               this.wsErrMsg = "网络已断开,请检查网络后重新打开页面";
306
               this.wsErrMsg = "网络已断开,请检查网络后重新打开页面";
307
               console.log('navigator',navigator)
307
               console.log('navigator',navigator)
308
+              let http = 'wss://socket.sgjyun.com?token=' 
309
+              // let http = 'ws://socket.szjkhd.com?token=' //测试
310
+              let token = localStorage.getItem("token")
311
+              this.$store.state.user.websocket = new ReconnectingWebSocket(
312
+                http + token
313
+              );
308
             } else if (
314
             } else if (
309
               navigator.onLine == true &&
315
               navigator.onLine == true &&
310
               this.websocket.readyState == 1
316
               this.websocket.readyState == 1
312
               this.showWsErr = false;
318
               this.showWsErr = false;
313
             }
319
             }
314
             this.websocket.send("1");
320
             this.websocket.send("1");
315
-          }, 55000);
321
+          }, 30000);
316
         }
322
         }
317
         
323
         
318
       }).catch(error => {
324
       }).catch(error => {