import { Injectable } from '@angular/core'; import * as signalR from "@microsoft/signalr" import { SessionStore } from '../store/session.service'; @Injectable({ providedIn: 'root' }) export class SocketConnectionMCRService { constructor() { } connect() { // console.log("SocketConnectionMCRService") var connection = new signalR.HubConnectionBuilder() .withUrl("https://gdcmapi-dev.dyndns.info/FileHub", { accessTokenFactory: () => SessionStore.user.Authorization }).configureLogging(signalR.LogLevel.Information) .build(); connection.on("ReceiveMessage", (message) => { console.log("ReceiveMessage", message) }) // connection.start() // .then(() => { // console.log("SignalR connection started."); // }) // .catch((error) => { // console.error("Error starting SignalR connection:", error); // }); // connection.onclose((error) => { // console.log("SignalR connection closed:", error); // }); } }