Improve service

This commit is contained in:
Peter Maquiran
2021-08-27 15:30:02 +01:00
parent d1f00d2840
commit 3367d8cef0
4 changed files with 14 additions and 23 deletions
+8 -13
View File
@@ -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()