websocket 需要保持长时间连接,需要增加心跳检测。
具体方法:
_this.websocket.onopen = function(){
console.log('open')
setInterval(function(){
_this.websocket.send({a:"a"}) //此处只是保持心跳,发送的内容无意义 //2min发送一次
},20000)
};
websocket 需要保持长时间连接,需要增加心跳检测。
具体方法:
_this.websocket.onopen = function(){
console.log('open')
setInterval(function(){
_this.websocket.send({a:"a"}) //此处只是保持心跳,发送的内容无意义 //2min发送一次
},20000)
};