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:
@@ -54,6 +54,18 @@ export class WsChatMethodsService {
|
||||
|
||||
})()
|
||||
|
||||
|
||||
/**
|
||||
* @description when the phone is in the background for a long time it could disconnects from the socket then the socket reconnects automatically,
|
||||
* when the connection is lost the subscribe is also lost, so we have to subscribe again when reconnection is establish.
|
||||
*/
|
||||
this.WsChatService.registerCallback({
|
||||
type: 'reConnect',
|
||||
funx: ()=>{
|
||||
this.subscribeToRoom()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
openRoom(roomId) {
|
||||
@@ -116,11 +128,17 @@ export class WsChatMethodsService {
|
||||
this.loadingWholeList = false
|
||||
}
|
||||
|
||||
/**
|
||||
* @description sort room list by last message date
|
||||
*/
|
||||
sortRoomList() {
|
||||
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
|
||||
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
|
||||
}
|
||||
|
||||
/**
|
||||
* @description subscribe all room
|
||||
*/
|
||||
subscribeToRoom() {
|
||||
|
||||
for (const id in this.dm) {
|
||||
|
||||
Reference in New Issue
Block a user