--- title: RTCPeerConnectionIceEvent slug: Web/API/RTCPeerConnectionIceEvent tags: - API - Experimental - Interface - NeedsTranslation - RTCIceCandidateEvent - Reference - TopicStub - WebRTC translation_of: Web/API/RTCPeerConnectionIceEvent ---

{{APIRef("WebRTC")}}

The RTCPeerConnectionIceEvent interface represents events that occurs in relation to {{Glossary("ICE")}} candidates with the target, usually an {{domxref("RTCPeerConnection")}}. Only one event is of this type: {{event("icecandidate")}}.

Properties

A {{domxref("RTCPeerConnectionIceEvent")}} being an {{domxref("Event")}}, this event also implements these properties.

{{domxref("RTCPeerConnectionIceEvent.candidate")}} {{readOnlyInline}}
Contains the {{domxref("RTCIceCandidate")}} containing the candidate associated with the event, or null if this event indicates that there are no further candidates to come.

Constructors

{{domxref("RTCPeerConnectionIceEvent.RTCPeerConnectionIceEvent()", "RTCPeerConnectionIceEvent()")}}
Returns a new RTCPeerConnectionIceEvent. It takes two parameters, the first being a {{domxref("DOMString")}} representing the type of the event; the second a dictionary containing the {{domxref("RTCIceCandidate")}} it refers to.

Methods

A {{domxref("RTCPeerConnectionIceEvent")}} being an {{domxref("Event")}}, this event also implements these propertiesThere is no specific {{domxref("RTCDataChannelEvent")}} method.

Examples

pc.onicecandidate = function( ev ) {
  alert("The ICE candidate (transport address: '" +
    ev.candidate.candidate +
    "') has been added to this connection.");
}

Specifications

Specification Status Comment
{{ SpecName('WebRTC 1.0', '#rtcpeerconnectioniceevent', 'RTCPeerConnectionIceEvent') }} {{Spec2('WebRTC 1.0')}} Initial definition.

Browser compatibility

{{Compat("api.RTCPeerConnectionIceEvent")}}

See also