mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Maybe
This commit is contained in:
@@ -40,6 +40,8 @@ import { RetryLink } from '@apollo/client/link/retry';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { switchMap, take, tap } from 'rxjs/operators';
|
import { switchMap, take, tap } from 'rxjs/operators';
|
||||||
import { FeaturesServiceToken, IFeaturesService } from '@alfresco/adf-core/feature-flags';
|
import { FeaturesServiceToken, IFeaturesService } from '@alfresco/adf-core/feature-flags';
|
||||||
|
import { BaseCloudService } from './base-cloud.service';
|
||||||
|
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||||
|
|
||||||
interface serviceOptions {
|
interface serviceOptions {
|
||||||
apolloClientName: string;
|
apolloClientName: string;
|
||||||
@@ -51,7 +53,7 @@ interface serviceOptions {
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class WebSocketService {
|
export class WebSocketService extends BaseCloudService {
|
||||||
private host = '';
|
private host = '';
|
||||||
private subscriptionProtocol: 'graphql-ws' | 'transport-ws' = 'transport-ws';
|
private subscriptionProtocol: 'graphql-ws' | 'transport-ws' = 'transport-ws';
|
||||||
private wsLink: GraphQLWsLink | WebSocketLink;
|
private wsLink: GraphQLWsLink | WebSocketLink;
|
||||||
@@ -59,12 +61,13 @@ export class WebSocketService {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly apollo: Apollo,
|
private readonly apollo: Apollo,
|
||||||
private readonly appConfigService: AppConfigService,
|
|
||||||
private readonly authService: AuthenticationService,
|
private readonly authService: AuthenticationService,
|
||||||
@Inject(FeaturesServiceToken) private featuresService: IFeaturesService,
|
@Inject(FeaturesServiceToken) private featuresService: IFeaturesService,
|
||||||
|
adfHttpClient: AdfHttpClient,
|
||||||
private logger: LogService
|
private logger: LogService
|
||||||
) {
|
) {
|
||||||
this.host = this.appConfigService.get('bpmHost', '');
|
super(adfHttpClient);
|
||||||
|
this.host = this.contextRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSubscription<T>(options: serviceOptions): Observable<FetchResult<T>> {
|
public getSubscription<T>(options: serviceOptions): Observable<FetchResult<T>> {
|
||||||
@@ -96,8 +99,8 @@ export class WebSocketService {
|
|||||||
url.protocol = protocol2;
|
url.protocol = protocol2;
|
||||||
const protocol = this.host.split('://')[0] === 'https' ? 'wss' : 'ws';
|
const protocol = this.host.split('://')[0] === 'https' ? 'wss' : 'ws';
|
||||||
const subHost = this.host.split('://')[1];
|
const subHost = this.host.split('://')[1];
|
||||||
const finalUrl = `${protocol}://${subHost}/${apolloClientName}/notifications/ws/graphql`;
|
const finalUrl = `${protocol}://${subHost}/${apolloClientName}/notifications`;
|
||||||
this.logger.info(`WebSocketService: createWsUrl: ${finalUrl}`);
|
this.logger.error(`WebSocketService: createWsUrl: ${finalUrl}`);
|
||||||
return finalUrl;
|
return finalUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user