RTCPeerConnectionIceEvent

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

The RTCPeerConnectionIceEvent interface represents events that occur in relation to ICE candidates with the target, usually an RTCPeerConnection.

Only one event is of this type: icecandidate.

Event RTCPeerConnectionIceEvent

Instance properties

A RTCPeerConnectionIceEvent being an Event, this event also implements these properties.

RTCPeerConnectionIceEvent.candidate Read only

Contains the RTCIceCandidate containing the candidate associated with the event, or null if this event indicates that there are no further candidates to come.

Constructors

RTCPeerConnectionIceEvent()

Returns a new RTCPeerConnectionIceEvent. It takes two parameters, the first being a string representing the type of the event; the second a dictionary containing the RTCIceCandidate it refers to.

Instance methods

A RTCPeerConnectionIceEvent being an Event, this event also implements these properties. There is no specific RTCDataChannelEvent method.

Examples

js
pc.onicecandidate = (ev) => {
  console.log(
    `The ICE candidate ('${ev.candidate.candidate}') added to connection.`,
  );
};

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# rtcpeerconnectioniceevent

Browser compatibility

BCD tables only load in the browser

See also