1、增加websocket保活
This commit is contained in:
parent
9f570d9da1
commit
d358b5c1b1
@ -152,7 +152,7 @@
|
||||
console.log("Socket open");
|
||||
intervalId = setInterval(function() {
|
||||
websocket.send("hello");
|
||||
}, 60000); // keepalive
|
||||
}, 50000); // keepalive
|
||||
|
||||
}
|
||||
websocket.onerror = function (){
|
||||
@ -160,13 +160,13 @@
|
||||
layui.layer.alert("Open web socket failed!");
|
||||
}
|
||||
websocket.onclose = function (){
|
||||
rxWin.append("websocket closed!")
|
||||
rxWin.append("websocket closed!");
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
//接收信息
|
||||
websocket.onmessage = function (event) {
|
||||
console.log(event.data);
|
||||
rxWin.val(rxWin.val()+event.data + "\r\n");
|
||||
rxWin.append(event.data + "\r\n");
|
||||
rxWin.scrollTop = rxWin.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user