mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-06-12 10:00:56 +08:00
优化代码
This commit is contained in:
parent
6823927d6e
commit
fa7dbd793f
@ -27,6 +27,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
_initParkingAreaWs:function(){
|
_initParkingAreaWs:function(){
|
||||||
|
let clientId = vc.uuid();
|
||||||
let heartCheck = {
|
let heartCheck = {
|
||||||
timeout: 30000, // 9分钟发一次心跳,比server端设置的连接时间稍微小一点,在接近断开的情况下以通信的方式去重置连接时间。
|
timeout: 30000, // 9分钟发一次心跳,比server端设置的连接时间稍微小一点,在接近断开的情况下以通信的方式去重置连接时间。
|
||||||
serverTimeoutObj: null,
|
serverTimeoutObj: null,
|
||||||
@ -51,7 +52,7 @@
|
|||||||
heartCheck.reset().start(); // 如果获取到消息,说明连接是正常的,重置心跳检测
|
heartCheck.reset().start(); // 如果获取到消息,说明连接是正常的,重置心跳检测
|
||||||
} else {
|
} else {
|
||||||
console.log("断开状态,尝试重连");
|
console.log("断开状态,尝试重连");
|
||||||
newWebSocket();
|
$that._initParkingAreaWs();
|
||||||
}
|
}
|
||||||
}, this.timeout)
|
}, this.timeout)
|
||||||
}
|
}
|
||||||
@ -114,7 +115,7 @@
|
|||||||
//连接关闭的回调方法
|
//连接关闭的回调方法
|
||||||
websocket.onclose = function () {
|
websocket.onclose = function () {
|
||||||
console.log("初始化失败");
|
console.log("初始化失败");
|
||||||
//newWebSocket();
|
//$that._initParkingAreaWs();
|
||||||
this.$notify.error({
|
this.$notify.error({
|
||||||
title: "错误",
|
title: "错误",
|
||||||
message: "连接关闭,请刷新浏览器"
|
message: "连接关闭,请刷新浏览器"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user