Back to Content

RTCPeerConnectionIceEvent

files/en-us/web/api/rtcpeerconnectioniceevent/index.md

latest1.8 KB
Original Source

{{APIRef("WebRTC")}}

The RTCPeerConnectionIceEvent interface represents events that occur in relation to {{Glossary("ICE")}} candidates with the target, usually an {{domxref("RTCPeerConnection")}}.

Only one event is of this type: {{domxref("RTCPeerConnection.icecandidate_event", "icecandidate")}}.

{{InheritanceDiagram}}

Instance properties

A 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.
  • {{domxref("RTCPeerConnectionIceEvent.url")}} {{ReadOnlyInline}} {{deprecated_inline}}
    • : Contains a string indicating the URL of the {{Glossary("STUN")}} or {{Glossary("TURN")}} server used to gather the candidate, or null if the candidate was not gathered from a server.

Constructors

  • {{domxref("RTCPeerConnectionIceEvent.RTCPeerConnectionIceEvent()", "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 {{domxref("RTCIceCandidate")}} it refers to.

Instance methods

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

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • WebRTC
  • Its usual target: {{domxref("RTCPeerConnection")}}.