소스 검색

websocket

彭宇 2 년 전
부모
커밋
f1e5466f53
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      src/views/forest.vue

+ 2 - 1
src/views/forest.vue

@@ -710,6 +710,7 @@ export default {
   /** ----------------------------------weosocket开始------------------------------------- */
   destroyed() { //离开页面关闭Socket连接
     if (this.websock) {
+      clearInterval(this.setIntervalWesocketPush)
       this.websock.close()
       this.websock = null
     }
@@ -718,7 +719,7 @@ export default {
   methods: {
     /** ----------------------------------weosocket开始------------------------------------- */
     initWebSocket() { //初始化weosocket
-      const wsuri = 'ws://192.168.1.103:10012/websocket/forest-' + Cookies.get('username')
+      const wsuri = 'wss://www.hmzzxc.com:10012/websocket/forest-' + Cookies.get('username')
       this.websock = new WebSocket(wsuri)
       console.log('建立websocket连接')
       this.websock.onopen = this.websocketonopen