diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 035f1debd..226533a97 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -162,6 +162,17 @@ export class HomePage implements OnInit { } ) + synchro.registerCallback('Online',()=>{ + + }) + + + synchro.registerCallback('Offline',()=>{ + + }) + + + synchro.registerCallback('Notification', (DataArray)=> { diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts index 8d9d4fbf6..f514297b0 100644 --- a/src/app/services/socket/synchro.service.ts +++ b/src/app/services/socket/synchro.service.ts @@ -81,11 +81,14 @@ class SynchroService { this.BackgroundService.online() - this.callBacks.forEach((e)=>{ - if(e.type == 'Online') { - e.funx() - } - }) + if(!this.conected) { + this.callBacks.forEach((e)=>{ + if(e.type == 'Online') { + e.funx() + } + }) + + } console.log('open ======================= welcome to socket server') this._connected = true @@ -169,13 +172,16 @@ class SynchroService { console.log('[close] Connection died'); console.log('Reconnect') - this.BackgroundService.offline(); + - this.callBacks.forEach((e)=>{ - if(e.type == 'Offline') { - e.funx() - } - }) + if(this._connected) { + this.BackgroundService.offline(); + this.callBacks.forEach((e)=>{ + if(e.type == 'Offline') { + e.funx() + } + }) + } // status this._connected = false