fix
parent
3a87d8f607
commit
2fad9b19fa
|
@ -62,6 +62,11 @@ $(function () {
|
|||
ws.onclose = function (e) {
|
||||
//当客户端收到服务端发送的关闭连接请求时,触发onclose事件
|
||||
console.log("websocket已断开");
|
||||
setTimeout(() => {
|
||||
console.log('重新连接')
|
||||
// 重新连接 WebSocket
|
||||
createWebSocket();
|
||||
}, 3000);
|
||||
}
|
||||
ws.onerror = function (e) {
|
||||
//如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
|
||||
|
|
Loading…
Reference in New Issue