| | |
| | | } |
| | | |
| | | if (window.WebSocket) { |
| | | that.socket = new WebSocket("ws://36.134.81.48:9034/websocket"); |
| | | that.socket.onmessage = function (event) { |
| | | window.socket = new WebSocket("ws://36.134.81.48:9034/websocket"); |
| | | window.socket.onmessage = function (event) { |
| | | }; |
| | | |
| | | that.socket.onopen = function (event) { |
| | | window.socket.onopen = function (event) { |
| | | }; |
| | | |
| | | that.socket.onclose = function (event) { |
| | | window.socket.onclose = function (event) { |
| | | }; |
| | | } else { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | |
| | | if(!window.WebSocket){ |
| | | return; |
| | | } |
| | | if(that.socket.readyState == WebSocket.OPEN){ |
| | | that.socket.send(that.userId); |
| | | if(window.socket.readyState == WebSocket.OPEN){ |
| | | window.socket.send(that.userId); |
| | | }else{ |
| | | console.log("WebSocket连接没有建立成功!!"); |
| | | } |
| | | }, 4000); |
| | | }, 2000); |
| | | |
| | | |
| | | axios({ |