This commit is contained in:
X1627315083
2024-12-11 16:26:36 +08:00
parent 5d9dc7b77d
commit a6ae63e7cd
96 changed files with 6163 additions and 9414 deletions

View File

@@ -8,6 +8,7 @@ class MyWs {
this.messageUrl = http+'/notification'
this.wsUrl = ''
this.reconnectionTime = null
this.times = 0
}
linkWs(url) {
if(!(JSON.parse(getCookie("userInfo"))))return
@@ -17,6 +18,7 @@ class MyWs {
this.ws.onmessage = (e)=>{
try {
MyWs.receiveText(JSON.parse(e.data))
this.times = 0
} catch (error) {
console.error('websocket',error)
}
@@ -32,7 +34,9 @@ class MyWs {
}
}
reconnection(){
this.times++
clearTimeout(this.reconnectionTime)
if(this.times>=10)return
this.reconnectionTime = setTimeout(()=>{
this.linkWs(this.wsUrl)
},1000)