Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh stale peer conection based on ICE connection state #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adamerce
Copy link
Contributor

Description of changes:
With persistent connection feature, RTC sessions can become stale if the CCP enters sleep/hibernate mode. This change will check the health of the ICE connection before connecting and recreate the peer connection if the ICE connection is not in a healthy state. If the ICE connection state is closed, failed, or disconnected then the peer connection may be stale or unusable and should be recreated. See https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState for documentation on ice connection state

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@anjpat anjpat self-requested a review February 18, 2022 20:40
@@ -871,7 +871,7 @@ export default class RtcSession {
var now = new Date();
self._sessionReport.sessionStartTime = now;
self._connectTimeStamp = now.getTime();
if (pc && pc.signalingState != 'closed') {
if (pc && pc.iceConnectionState != 'closed' && pc.iceConnectionState != 'failed' && pc.iceConnectionState != 'disconnected') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided that we will be adding unit tests for any changes going forward. So please make sure this change is unit tested.

Copy link
Contributor

@Vignendra Vignendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unit test for your change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants