添加重连次数太多的保险措施

pull/109/head
John Smith 1 year ago
parent 78828963ce
commit a50461d4e6

@ -1 +1 @@
Subproject commit 356837c136589b92fb2d9f2f26ad3ae1a338f39d
Subproject commit b1d066b59fabe106ce70a822e9f6e6ba29242519

@ -122,6 +122,15 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase {
return true
}
async onBeforeWsConnect() {
// 重连次数太多则重新init_room保险
let reinitPeriod = Math.max(3, (this.hostServerUrlList || []).length)
if (this.retryCount > 0 && this.retryCount % reinitPeriod === 0) {
this.needInitRoom = true
}
return super.onBeforeWsConnect()
}
getWsUrl() {
return this.hostServerUrlList[this.retryCount % this.hostServerUrlList.length]
}

@ -35,6 +35,15 @@ export default class ChatClientDirectWeb extends ChatClientOfficialBase {
return true
}
async onBeforeWsConnect() {
// 重连次数太多则重新init_room保险
let reinitPeriod = Math.max(3, (this.hostServerList || []).length)
if (this.retryCount > 0 && this.retryCount % reinitPeriod === 0) {
this.needInitRoom = true
}
return super.onBeforeWsConnect()
}
getWsUrl() {
let hostServer = this.hostServerList[this.retryCount % this.hostServerList.length]
return `wss://${hostServer.host}:${hostServer.wss_port}/sub`

Loading…
Cancel
Save