mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
resubcribe on reconnect
This commit is contained in:
@@ -572,6 +572,7 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
private socket!: WebSocket;
|
||||
private wsMsgQueue : {[key: string]: msgQueue} = {}
|
||||
private wsCallbacks: {[key: string]: wsCallbacksParams} = {}
|
||||
private wsReconnect = 0
|
||||
|
||||
private ws = {
|
||||
connected: false,
|
||||
@@ -592,9 +593,26 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) {
|
||||
},
|
||||
onopen:()=> {
|
||||
this.ws.connected = true
|
||||
|
||||
console.log('================== welcome to socket server =====================')
|
||||
|
||||
this.ws.wsMsgQueue()
|
||||
|
||||
if(this.wsReconnect >= 1) {
|
||||
for (const [key, value] of Object.entries(this.wsCallbacks)) {
|
||||
if(value.type== 'reConnect') {
|
||||
const dontRepeat = value.funx()
|
||||
|
||||
if(dontRepeat) {
|
||||
delete this.wsCallbacks[key]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.wsReconnect++;
|
||||
},
|
||||
wsMsgQueue:()=> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user