|
@@ -430,21 +430,22 @@ export default class BridgeChannel {
|
430
|
430
|
return;
|
431
|
431
|
}
|
432
|
432
|
|
433
|
|
- if (this._mode === 'websocket') {
|
434
|
|
- if (!this._closedFromClient) {
|
435
|
|
- this._retryWebSocketConnection(event);
|
436
|
|
- }
|
437
|
|
- }
|
|
433
|
+ // When the JVB closes the connection gracefully due to the participant being alone in
|
|
434
|
+ // the meeting it uses code 1001, so treat that as a graceful close and don't say
|
|
435
|
+ // anything.
|
|
436
|
+ const isGracefulClose = this._closedFromClient || event.code === 1001;
|
438
|
437
|
|
439
|
|
- if (!this._closedFromClient) {
|
|
438
|
+ if (!isGracefulClose) {
|
440
|
439
|
const { code, reason } = event;
|
441
|
440
|
|
442
|
441
|
logger.error(`Channel closed: ${code} ${reason}`);
|
443
|
442
|
|
444
|
|
- // We only want to send this event the first time the failure happens.
|
445
|
|
- if (typeof this._connected === 'undefined' || this._connected) {
|
446
|
|
- this._connected = false;
|
|
443
|
+ if (this._mode === 'websocket') {
|
|
444
|
+ this._retryWebSocketConnection(event);
|
|
445
|
+ }
|
447
|
446
|
|
|
447
|
+ // We only want to send this event the first time the failure happens.
|
|
448
|
+ if (this._connected !== false) {
|
448
|
449
|
emitter.emit(RTCEvents.DATA_CHANNEL_CLOSED, {
|
449
|
450
|
code,
|
450
|
451
|
reason
|
|
@@ -452,6 +453,8 @@ export default class BridgeChannel {
|
452
|
453
|
}
|
453
|
454
|
}
|
454
|
455
|
|
|
456
|
+ this._connected = false;
|
|
457
|
+
|
455
|
458
|
// Remove the channel.
|
456
|
459
|
this._channel = null;
|
457
|
460
|
};
|