added base service
This commit is contained in:
parent
247ce78c2b
commit
5d8f5578c3
@ -2591,6 +2591,25 @@
|
|||||||
"integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==",
|
"integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@microsoft/signalr": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/@microsoft/signalr/-/signalr-5.0.0.tgz",
|
||||||
|
"integrity": "sha1-DWT9HTIKxPv16SUCM0m4R63DSOo=",
|
||||||
|
"requires": {
|
||||||
|
"abort-controller": "^3.0.0",
|
||||||
|
"eventsource": "^1.0.7",
|
||||||
|
"fetch-cookie": "^0.7.3",
|
||||||
|
"node-fetch": "^2.6.0",
|
||||||
|
"ws": "^6.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"node-fetch": {
|
||||||
|
"version": "2.6.1",
|
||||||
|
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||||
|
"integrity": "sha1-BFvTI2Mfdu0uK1VXM5RBa2OaAFI="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@ngtools/webpack": {
|
"@ngtools/webpack": {
|
||||||
"version": "8.3.26",
|
"version": "8.3.26",
|
||||||
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-8.3.26.tgz",
|
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-8.3.26.tgz",
|
||||||
@ -2960,6 +2979,14 @@
|
|||||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
|
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"abort-controller": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-6vVNU7YrrkE46AnKIlyEOabvs5I=",
|
||||||
|
"requires": {
|
||||||
|
"event-target-shim": "^5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"accepts": {
|
"accepts": {
|
||||||
"version": "1.3.7",
|
"version": "1.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
@ -3291,8 +3318,7 @@
|
|||||||
"async-limiter": {
|
"async-limiter": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
||||||
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
|
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"asynckit": {
|
"asynckit": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
@ -5267,6 +5293,11 @@
|
|||||||
"is-symbol": "^1.0.2"
|
"is-symbol": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"es6-denodeify": {
|
||||||
|
"version": "0.1.5",
|
||||||
|
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/es6-denodeify/-/es6-denodeify-0.1.5.tgz",
|
||||||
|
"integrity": "sha1-MdTV/pxVA+ElRgQ5MQ4WoqPznB8="
|
||||||
|
},
|
||||||
"es6-promise": {
|
"es6-promise": {
|
||||||
"version": "4.2.8",
|
"version": "4.2.8",
|
||||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||||
@ -5332,6 +5363,11 @@
|
|||||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
|
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"event-target-shim": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||||
|
"integrity": "sha1-XU0+vflYPWOlMzzi3rdICrKwV4k="
|
||||||
|
},
|
||||||
"eventemitter3": {
|
"eventemitter3": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz",
|
||||||
@ -5348,7 +5384,6 @@
|
|||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz",
|
||||||
"integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==",
|
"integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"original": "^1.0.0"
|
"original": "^1.0.0"
|
||||||
}
|
}
|
||||||
@ -5659,6 +5694,15 @@
|
|||||||
"websocket-driver": ">=0.5.1"
|
"websocket-driver": ">=0.5.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fetch-cookie": {
|
||||||
|
"version": "0.7.3",
|
||||||
|
"resolved": "https://artifactory.platform.vwfs.io/artifactory/api/npm/vwfs-du-cp-npm-virtual/fetch-cookie/-/fetch-cookie-0.7.3.tgz",
|
||||||
|
"integrity": "sha1-uNAj9CHdKy9KDsqc1zGKln7U7tg=",
|
||||||
|
"requires": {
|
||||||
|
"es6-denodeify": "^0.1.1",
|
||||||
|
"tough-cookie": "^2.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"figgy-pudding": {
|
"figgy-pudding": {
|
||||||
"version": "3.5.1",
|
"version": "3.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz",
|
||||||
@ -8881,7 +8925,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz",
|
||||||
"integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==",
|
"integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"url-parse": "^1.4.3"
|
"url-parse": "^1.4.3"
|
||||||
}
|
}
|
||||||
@ -9632,8 +9675,7 @@
|
|||||||
"querystringify": {
|
"querystringify": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz",
|
||||||
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==",
|
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"randombytes": {
|
"randombytes": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
@ -9974,8 +10016,7 @@
|
|||||||
"requires-port": {
|
"requires-port": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||||
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
|
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.15.1",
|
"version": "1.15.1",
|
||||||
@ -11799,7 +11840,6 @@
|
|||||||
"version": "1.4.7",
|
"version": "1.4.7",
|
||||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",
|
||||||
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
|
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"querystringify": "^2.1.1",
|
"querystringify": "^2.1.1",
|
||||||
"requires-port": "^1.0.0"
|
"requires-port": "^1.0.0"
|
||||||
@ -13781,7 +13821,6 @@
|
|||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
|
||||||
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"async-limiter": "~1.0.0"
|
"async-limiter": "~1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"@angular/platform-browser-dynamic": "8.2.12",
|
"@angular/platform-browser-dynamic": "8.2.12",
|
||||||
"@angular/platform-server": "8.2.12",
|
"@angular/platform-server": "8.2.12",
|
||||||
"@angular/router": "8.2.12",
|
"@angular/router": "8.2.12",
|
||||||
|
"@microsoft/signalr": "^5.0.0",
|
||||||
"@nguniversal/module-map-ngfactory-loader": "8.1.1",
|
"@nguniversal/module-map-ngfactory-loader": "8.1.1",
|
||||||
"aspnet-prerendering": "^3.0.1",
|
"aspnet-prerendering": "^3.0.1",
|
||||||
"bootstrap": "^4.3.1",
|
"bootstrap": "^4.3.1",
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
import { Inject, Injectable } from '@angular/core';
|
||||||
|
import {
|
||||||
|
HubConnection,
|
||||||
|
HubConnectionBuilder,
|
||||||
|
HubConnectionState,
|
||||||
|
LogLevel
|
||||||
|
} from '@microsoft/signalr';
|
||||||
|
import { BehaviorSubject} from 'rxjs';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class SignalRService {
|
||||||
|
connectionEstablished$ = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
|
public hubConnection: HubConnection;
|
||||||
|
|
||||||
|
constructor(@Inject('BASE_URL') baseUrl: string) {
|
||||||
|
this.createConnection(baseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private createConnection(baseUrl: string) {
|
||||||
|
this.hubConnection = new HubConnectionBuilder()
|
||||||
|
.withUrl( baseUrl + 'sessionhub')
|
||||||
|
.withAutomaticReconnect()
|
||||||
|
.configureLogging(LogLevel.Information)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public startConnection() {
|
||||||
|
if (this.hubConnection.state === HubConnectionState.Connected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hubConnection.start().then(
|
||||||
|
() => {
|
||||||
|
console.log('Hub connection started!');
|
||||||
|
this.connectionEstablished$.next(true);
|
||||||
|
},
|
||||||
|
error => console.error(error)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import { Inject, Injectable } from '@angular/core';
|
||||||
|
import { SignalRService } from './base/signalR.service';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class GMSignalRService {
|
||||||
|
signalR: SignalRService;
|
||||||
|
|
||||||
|
constructor(@Inject('BASE_URL') baseUrl: string) {
|
||||||
|
this.signalR = new SignalRService(baseUrl);
|
||||||
|
this.registerOnServerEvents();
|
||||||
|
this.signalR.startConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private registerOnServerEvents(): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import { Inject, Injectable } from '@angular/core';
|
||||||
|
import { SignalRService } from './base/signalR.service';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class PlayerSignalRService {
|
||||||
|
signalR: SignalRService;
|
||||||
|
|
||||||
|
constructor(@Inject('BASE_URL') baseUrl: string) {
|
||||||
|
this.signalR = new SignalRService(baseUrl);
|
||||||
|
this.registerOnServerEvents();
|
||||||
|
this.signalR.startConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private registerOnServerEvents(): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user