The RTCIceCandidatePair dictionary describes a pair of ICE candidates which together comprise a description of a viable connection between two WebRTC endpoints. It is used as the return value from RTCIceTransport.getSelectedCandidatePair() to identify the currently-selected candidate pair identified by the ICE agent.


An RTCIceCandidate describing the configuration of the local end of the connection.
The RTCIceCandidate describing the configuration of the remote end of the connection.


In this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair.

var iceTransport = pc.getSenders()[0].transport.iceTransport;
var localProto = document.getElementById("local-protocol");
var remoteProto = document.getElementById("remote-protocol");

iceTransport.onselectedcandidatepairchange = function(event) {
  var pair = iceTransport.getSelectedCandidatePair();
  localProtocol.innerText = pair.local.protocol.toUpperCase();
  remoteProtocol.innerText = pair.remote.protocol.toUpperCase();


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

Browser compatibility

No compatibility data found. Please contribute data for "api.RTCIceCandidatePair" (depth: 1) to the MDN compatibility data repository.