mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Improve service
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { BackgroundService } from '../background.service';
|
||||
|
||||
export interface wss{
|
||||
|
||||
url: string,
|
||||
type: 'reflect' | 'emit'
|
||||
header: {
|
||||
id: string
|
||||
bluePrint: string,
|
||||
jwt: string
|
||||
id: string
|
||||
bluePrint: string,
|
||||
jwt: string
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +26,7 @@ export class SynchroService {
|
||||
private url: string = ''
|
||||
callback = function(){}
|
||||
private _connected = false;
|
||||
private BackgroundService = new BackgroundService()
|
||||
|
||||
constructor(){}
|
||||
|
||||
@@ -60,11 +62,8 @@ export class SynchroService {
|
||||
}
|
||||
|
||||
private onopen = () =>{
|
||||
document.body.style.setProperty(`--color`, "#0782C9");
|
||||
document.body.style.setProperty(`--color2`, "#45BAFF");
|
||||
document.body.style.setProperty(`--color3`, "#0782C9");
|
||||
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
||||
document.body.style.setProperty(`--color5`, "#45BAFF");
|
||||
|
||||
this.BackgroundService.online()
|
||||
console.log('open ======================= welcome to socket server')
|
||||
this._connected = true
|
||||
|
||||
@@ -96,11 +95,7 @@ export class SynchroService {
|
||||
// event.code is usually 1006 in this case
|
||||
console.log('[close] Connection died');
|
||||
console.log('Reconnect')
|
||||
document.body.style.setProperty(`--color`, "#ffb703");
|
||||
document.body.style.setProperty(`--color2`, "#ffb703");
|
||||
document.body.style.setProperty(`--color3`, "#ffb703");
|
||||
document.body.style.setProperty(`--color4`, "#ffb703");
|
||||
document.body.style.setProperty(`--color5`, "#ffb703");
|
||||
this.BackgroundService.offline();
|
||||
this._connected = false
|
||||
this.connect()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user