mirror of https://github.com/OpenVidu/openvidu.git
openvidu-testapp: reconnect on server failure
parent
e785519b33
commit
5aed7fa9f0
|
@ -50,3 +50,7 @@ mat-radio-button:first-child {
|
|||
mat-form-field {
|
||||
margin-right: 9px;
|
||||
}
|
||||
|
||||
#force-publishing-checkbox {
|
||||
margin-right: 10px;
|
||||
}
|
|
@ -118,10 +118,13 @@
|
|||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div id="force-publishing-div">
|
||||
<div>
|
||||
<mat-checkbox class="checkbox-form" [(ngModel)]="forcePublishing" id="force-publishing-checkbox">Force
|
||||
publishing
|
||||
</mat-checkbox>
|
||||
<mat-checkbox class="checkbox-form" [(ngModel)]="reconnectionOnServerFailure" id="reconnection-on-server-failure-checkbox">
|
||||
Reconnection on server failure
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -132,5 +135,5 @@
|
|||
<mat-dialog-actions>
|
||||
<button id="cancel-btn" mat-button [mat-dialog-close]="undefined">CANCEL</button>
|
||||
<button id="save-btn" mat-button
|
||||
[mat-dialog-close]="{sessionProperties: sessionProperties, turnConf: turnConf, manualTurnConf: manualTurnConf, customToken: customToken, forcePublishing: forcePublishing, connectionProperties: generateConnectionProperties()}">SAVE</button>
|
||||
[mat-dialog-close]="{sessionProperties: sessionProperties, turnConf: turnConf, manualTurnConf: manualTurnConf, customToken: customToken, forcePublishing: forcePublishing, reconnectionOnServerFailure: reconnectionOnServerFailure, connectionProperties: generateConnectionProperties()}">SAVE</button>
|
||||
</mat-dialog-actions>
|
||||
|
|
|
@ -15,6 +15,7 @@ export class SessionPropertiesDialogComponent {
|
|||
manualTurnConf: RTCIceServer = { urls: [] };
|
||||
customToken: string;
|
||||
forcePublishing: boolean = false;
|
||||
reconnectionOnServerFailure: boolean = false;
|
||||
connectionProperties: ConnectionProperties;
|
||||
forceVideoCodec = VideoCodec;
|
||||
|
||||
|
@ -33,6 +34,7 @@ export class SessionPropertiesDialogComponent {
|
|||
this.manualTurnConf = data.manualTurnConf;
|
||||
this.customToken = data.customToken;
|
||||
this.forcePublishing = data.forcePublishing;
|
||||
this.reconnectionOnServerFailure = data.reconnectionOnServerFailure;
|
||||
this.connectionProperties = data.connectionProperties;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
manualTurnConf: RTCIceServer = { urls: [] };
|
||||
customToken: string;
|
||||
forcePublishing: boolean;
|
||||
reconnectionOnServerFailure: boolean;
|
||||
connectionProperties: ConnectionProperties = {
|
||||
role: OpenViduRole.PUBLISHER,
|
||||
record: true,
|
||||
|
@ -448,12 +449,20 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
if (this.sessionEvents.sessionDisconnected !== oldValues.sessionDisconnected || firstTime) {
|
||||
this.session.off('sessionDisconnected');
|
||||
if (this.sessionEvents.sessionDisconnected) {
|
||||
this.session.on('sessionDisconnected', (event: SessionDisconnectedEvent) => {
|
||||
this.session.on('sessionDisconnected', async (event: SessionDisconnectedEvent) => {
|
||||
this.updateEventList('sessionDisconnected', '', event);
|
||||
this.subscribers = [];
|
||||
delete this.publisher;
|
||||
delete this.session;
|
||||
delete this.OV;
|
||||
|
||||
if (event.reason === 'nodeCrashed' && this.reconnectionOnServerFailure) {
|
||||
console.warn('Reconnecting after node crash');
|
||||
await this.initializeNodeClient((event.target as Session).sessionId);
|
||||
const connection: Connection = await this.createConnection();
|
||||
this.joinSessionShared(connection.token);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -634,6 +643,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
manualTurnConf: this.manualTurnConf,
|
||||
customToken: this.customToken,
|
||||
forcePublishing: this.forcePublishing,
|
||||
reconnectionOnServerFailure: this.reconnectionOnServerFailure,
|
||||
connectionProperties: this.connectionProperties,
|
||||
}
|
||||
});
|
||||
|
@ -648,6 +658,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.manualTurnConf = result.manualTurnConf;
|
||||
this.customToken = result.customToken;
|
||||
this.forcePublishing = result.forcePublishing;
|
||||
this.reconnectionOnServerFailure = result.reconnectionOnServerFailure;
|
||||
this.connectionProperties = result.connectionProperties;
|
||||
}
|
||||
document.getElementById('session-settings-btn-' + this.index).classList.remove('cdk-program-focused');
|
||||
|
|
Loading…
Reference in New Issue