mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-03-13 03:10:47 +08:00
添加重连次数太多的保险措施
This commit is contained in:
parent
78828963ce
commit
a50461d4e6
2
blivedm
2
blivedm
@ -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…
Reference in New Issue
Block a user