mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
45 lines
1014 B
TypeScript
45 lines
1014 B
TypeScript
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);
|
|
// });
|
|
|
|
}
|
|
|
|
}
|