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

feat(restartIce) #155

Merged
merged 1 commit into from
Feb 12, 2021
Merged

feat(restartIce) #155

merged 1 commit into from
Feb 12, 2021

Conversation

adwpc
Copy link
Contributor

@adwpc adwpc commented Feb 11, 2021

Description

add restartIce

Reference issue

Fixes #154
depend on #156

@adwpc
Copy link
Contributor Author

adwpc commented Feb 11, 2021

Reference:
https://developer.mozilla.org/en-US/docs/Web/API/RTCOfferOptions/iceRestart

pc.oniceconnectionstatechange = function(evt) {
  if (pc.iceConnectionState === "failed") {
    if (pc.restartIce) {
      pc.restartIce();
    } else {
      pc.createOffer({ iceRestart: true })
      .then(pc.setLocalDescription)
      .then(sendOfferToServer);
    }
  }
}

@tarrencev
Copy link
Contributor

lgtm! have you been able to test it? do we require any changes on the sfu side?

@adwpc
Copy link
Contributor Author

adwpc commented Feb 12, 2021

In my test:
1 iceConnectionState changed to "disconnected" in 35s after i switched my network
2 restartIce will trigger onNegotiationNeeded(createOffer-->setLocalDescription-->signal.offer-->setRemoteDescription), signal should support reconnect first(jsonrpc and grpc :()
https://stackoverflow.com/questions/13797262/how-to-reconnect-to-websocket-after-close-connection
need this one: #156

@adwpc adwpc mentioned this pull request Feb 12, 2021
@adwpc adwpc requested a review from tarrencev February 12, 2021 07:21
@adwpc adwpc merged commit 25ab56a into master Feb 12, 2021
@adwpc adwpc deleted the restart-ice branch February 12, 2021 12:30
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.

(feat)ice restart
2 participants