Refresh projector data after *every* (re)connect (closes #4691)

This commit is contained in:
FinnStutzenstein 2019-05-10 12:24:28 +02:00
parent 643bab111c
commit c4402f733e
3 changed files with 10 additions and 9 deletions

View File

@ -48,7 +48,7 @@ export class OpenSlidesService {
) { ) {
// Handler that gets called, if the websocket connection reconnects after a disconnection. // 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. // There might have changed something on the server, so we check the operator, if he changed.
websocketService.reconnectEvent.subscribe(() => { websocketService.retryReconnectEvent.subscribe(() => {
this.checkOperator(); this.checkOperator();
}); });

View File

@ -51,7 +51,7 @@ export class ProjectorDataService {
}); });
}); });
this.websocketService.reconnectEvent.subscribe(() => this.updateProjectorDataSubscription()); this.websocketService.connectEvent.subscribe(() => this.updateProjectorDataSubscription());
} }
/** /**

View File

@ -54,15 +54,16 @@ export class WebsocketService {
private connectionErrorNotice: MatSnackBarRef<SimpleSnackBar>; private connectionErrorNotice: MatSnackBarRef<SimpleSnackBar>;
/** /**
* 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<void> = new EventEmitter<void>(); private _retryReconnectEvent: EventEmitter<void> = new EventEmitter<void>();
/** /**
* Getter for the reconnect event. * Getter for the retry reconnect event.
*/ */
public get reconnectEvent(): EventEmitter<void> { public get retryReconnectEvent(): EventEmitter<void> {
return this._reconnectEvent; return this._retryReconnectEvent;
} }
/** /**
@ -195,10 +196,10 @@ export class WebsocketService {
if (retry) { if (retry) {
this.dismissConnectionErrorNotice(); this.dismissConnectionErrorNotice();
this._reconnectEvent.emit(); this._retryReconnectEvent.emit();
} }
this._connectEvent.emit();
this._connectionOpen = true; this._connectionOpen = true;
this._connectEvent.emit();
this.sendQueueWhileNotConnected.forEach(entry => { this.sendQueueWhileNotConnected.forEach(entry => {
this.websocket.send(entry); this.websocket.send(entry);
}); });