don't kill webrtc on temporary network issues #48.

This commit is contained in:
Miroslav Šedivý 2021-06-27 22:20:15 +02:00
parent 733c39412b
commit 86a9effe41

View File

@ -228,11 +228,15 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
case 'connected': case 'connected':
this.onConnected() this.onConnected()
break break
// https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling#ice_connection_state
// We don't watch the disconnected signaling state here as it can indicate temporary issues and may
// go back to a connected state after some time. Watching it would close the video call on any temporary
// network issue.
case 'failed': case 'failed':
this.onDisconnected(new Error('peer failed')) this.onDisconnected(new Error('peer failed'))
break break
case 'disconnected': case 'closed':
this.onDisconnected(new Error('peer disconnected')) this.onDisconnected(new Error('peer closed'))
break break
} }
} }