From c4402f733e398b5c3dbd9633940eb72647bd8416 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Fri, 10 May 2019 12:24:28 +0200 Subject: [PATCH] Refresh projector data after *every* (re)connect (closes #4691) --- .../app/core/core-services/openslides.service.ts | 2 +- .../core/core-services/projector-data.service.ts | 2 +- .../app/core/core-services/websocket.service.ts | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/client/src/app/core/core-services/openslides.service.ts b/client/src/app/core/core-services/openslides.service.ts index 014595cec..660989099 100644 --- a/client/src/app/core/core-services/openslides.service.ts +++ b/client/src/app/core/core-services/openslides.service.ts @@ -48,7 +48,7 @@ export class OpenSlidesService { ) { // Handler that gets called, if the websocket connection reconnects after a disconnection. // There might have changed something on the server, so we check the operator, if he changed. - websocketService.reconnectEvent.subscribe(() => { + websocketService.retryReconnectEvent.subscribe(() => { this.checkOperator(); }); diff --git a/client/src/app/core/core-services/projector-data.service.ts b/client/src/app/core/core-services/projector-data.service.ts index 21ebc7a2f..7b3a2358d 100644 --- a/client/src/app/core/core-services/projector-data.service.ts +++ b/client/src/app/core/core-services/projector-data.service.ts @@ -51,7 +51,7 @@ export class ProjectorDataService { }); }); - this.websocketService.reconnectEvent.subscribe(() => this.updateProjectorDataSubscription()); + this.websocketService.connectEvent.subscribe(() => this.updateProjectorDataSubscription()); } /** diff --git a/client/src/app/core/core-services/websocket.service.ts b/client/src/app/core/core-services/websocket.service.ts index 4221abe0d..49cfa4346 100644 --- a/client/src/app/core/core-services/websocket.service.ts +++ b/client/src/app/core/core-services/websocket.service.ts @@ -54,15 +54,16 @@ export class WebsocketService { private connectionErrorNotice: MatSnackBarRef; /** - * Subjects that will be called, if a reconnect was successful. + * Subjects that will be called, if a reconnect after a retry (e.g. with a previous + * connection loss) was successful. */ - private _reconnectEvent: EventEmitter = new EventEmitter(); + private _retryReconnectEvent: EventEmitter = new EventEmitter(); /** - * Getter for the reconnect event. + * Getter for the retry reconnect event. */ - public get reconnectEvent(): EventEmitter { - return this._reconnectEvent; + public get retryReconnectEvent(): EventEmitter { + return this._retryReconnectEvent; } /** @@ -195,10 +196,10 @@ export class WebsocketService { if (retry) { this.dismissConnectionErrorNotice(); - this._reconnectEvent.emit(); + this._retryReconnectEvent.emit(); } - this._connectEvent.emit(); this._connectionOpen = true; + this._connectEvent.emit(); this.sendQueueWhileNotConnected.forEach(entry => { this.websocket.send(entry); });