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

Expose ICE gathering state and state change event #276

Merged
merged 2 commits into from
Jul 17, 2023
Merged

Conversation

ibc
Copy link
Member

@ibc ibc commented Jul 17, 2023

Fixes #253

The problem this PR resolves is perfectly explained in the linked issue:

Problem

Under normal circumstances, in case of connection issues, the ICE connection should eventually fail. connectionstatechange event will fire, and the application will have the opportunity to do something with it.

However, if all ICE candidates error during the gathering, the connection will forever stay in a new state and connectionstatechange event will never fire.

Details

  • Add transport.iceGatheringState getter.
  • Add transport.on('iceGatheringStateChangeEventNumTimesCalled', (iceGatheringState) => { }) event,
  • Bonus track: Reset transport.connectionState to "closed" within transport.close() method.

NOTE: This is done in all handlers. It may happen that super old ones (Chrome55) don't support icegatheringstatechange event. I won't do magic. We'll remove those super old handlers soon anyway.

Fixes #253

- Add `transport.iceGatheringState` getter.
- Add `transport.on('iceGatheringStateChangeEventNumTimesCalled', (iceGatheringState) => { })` event,
- Bonus track: Reset `transport.connectionState` to "closed" within `transport.close()` method.

*NOTE:* This is done in all handlers. It may happen that super old ones (`Chrome55`) don't support `icegatheringstatechange` event. I won't do magic. We'll remove those super old handlers soon anyway.
@ibc ibc added this to the v3 updates milestone Jul 17, 2023
@ibc ibc merged commit 99714af into v3 Jul 17, 2023
4 checks passed
@ibc ibc deleted the expose-ice-gathering-state branch July 17, 2023 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Detecting ICE connection that will never connect
1 participant