Skip to content

Refresh stale peer conection based on ICE connection state#80

Open
adamerce wants to merge 1 commit intoaws:masterfrom
adamerce:master
Open

Refresh stale peer conection based on ICE connection state#80
adamerce wants to merge 1 commit intoaws:masterfrom
adamerce:master

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
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