aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_services/signal-r.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_services/signal-r.service.ts')
-rw-r--r--frontend/src/app/_services/signal-r.service.ts34
1 files changed, 16 insertions, 18 deletions
diff --git a/frontend/src/app/_services/signal-r.service.ts b/frontend/src/app/_services/signal-r.service.ts
index 5eca48d3..2a6e5d78 100644
--- a/frontend/src/app/_services/signal-r.service.ts
+++ b/frontend/src/app/_services/signal-r.service.ts
@@ -6,25 +6,23 @@ import { CookieService } from 'ngx-cookie-service';
providedIn: 'root'
})
export class SignalRService {
-private hubConnection?:signalR.HubConnection;
-public startConnection=()=>{
+ public hubConnection?: signalR.HubConnection;
+ public startConnection = () => {
- this.hubConnection= new signalR.HubConnectionBuilder()
- .withUrl('http://localhost:5283/chatHub', {
- accessTokenFactory: () => this.cookie.get("token"),
- withCredentials: false
- }).build();
+ this.hubConnection = new signalR.HubConnectionBuilder()
+ .withUrl('http://localhost:5283/chatHub', {
+ accessTokenFactory: () => this.cookie.get("token"),
+ withCredentials: false
+ }).build();
- this.hubConnection.on("Notify",(message:string) =>{
- console.log(" "+message);
- });
+ this.hubConnection.on("Notify", (message: string) => {
+ console.log(" " + message);
+ });
-
-
- this.hubConnection
- .start()
- .then(()=>console.log("con Started"))
- .catch(err=>console.log("Error"+err))
-}
- constructor(private cookie:CookieService) { }
+ this.hubConnection
+ .start()
+ .then(() => console.log("con Started"))
+ .catch(err => console.log("Error" + err))
+ }
+ constructor(private cookie: CookieService) { }
}