RTCOfferOptions.iceRestart

The iceRestart property of the RTCOfferOptions dictionary is a Boolean value which, when true, tells the RTCPeerConnection to start ICE renegotiation.

This renegotiation is triggered by generating and using new values for the ICE username fragment ("ufrag")}}

Syntax

var options = {
  iceRestart: trueOrFalse
};

Value

A Boolean value indicating whether or not the RTCPeerConnection should generate new values for the connection's ice-ufrag and ice-pwd values, which will trigger ICE renegotiation on the next message sent to the remote peer.

Usage notes

When the RTCPeerConnection object's ICE connection state changes to "failed", you should try to trigger an ICE restart.

Example

This example shows a handler for the iceconnectionstatechange event. It watches for the ICE connection state to transition to "failed", which indicates that an ICE restart should be tried in order to attempt to bring the connection back up.

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

If the state changes to "failed", a new offer is created with iceRestart set to true, then that offer is set as the new local description for the connection. After that, the offer is sent to the server by calling a custom function sendOfferToServer().

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCOfferOptions.iceRestart' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 50Edge ? Firefox No support NoIE No support NoOpera ? Safari ? WebView Android Full support 50Chrome Android Full support 50Edge Mobile ? Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

 

Document Tags and Contributors

Contributors to this page: Sheppy
Last updated by: Sheppy,