files/en-us/web/api/rtcicecandidate/index.md
{{APIRef("WebRTC")}}
The RTCIceCandidate interface—part of the WebRTC API—represents a candidate Interactive Connectivity Establishment ({{Glossary("ICE")}}) configuration which may be used to establish an {{domxref("RTCPeerConnection")}}.
An ICE candidate describes the protocols and routing needed for WebRTC to be able to communicate with a remote device. When starting a WebRTC peer connection, typically a number of candidates are proposed by each end of the connection, until they mutually agree upon one which describes the connection they decide will be best. WebRTC then uses that candidate's details to initiate the connection.
For details on how the ICE process works, see Lifetime of a WebRTC session. The article WebRTC connectivity provides additional useful details.
: Creates an RTCIceCandidate object to represent a single ICE candidate, optionally configured based on a configuration object.
[!NOTE] For backwards compatibility, the constructor also accepts as input a string containing the value of the {{domxref("RTCIceCandidate.candidate", "candidate")}} property instead of the configuration object.
candidate-attribute as defined in {{RFC(5245)}}. This string is empty ("") if the RTCIceCandidate is an "end of candidates" indicator.rtp or rtcp, and is derived from the "component-id" field in the candidate a-line string."tcp" or "udp".relatedAddress is a string containing that host candidate's IP address. For host candidates, this value is null.relatedPort is a number indicating the port number of the candidate from which this candidate is derived. For host candidates, the relatedPort property is null.null if no such association exists.null, sdpMLineIndex indicates the zero-based index number of the media description (as defined in RFC 4566) in the {{Glossary("SDP")}} with which the candidate is associated.protocol is "tcp", tcpType represents the type of TCP candidate. Otherwise, tcpType is null.RTCIceCandidate.type.usernameFragment, even across ICE restarts.RTCIceCandidate's current configuration.
The format of the representation is the same as the candidateInfo object that can optionally be passed to the {{domxref("RTCIceCandidate.RTCIceCandidate()","RTCIceCandidate()")}} constructor to configure a candidate.For examples, see the article Signaling and video calling, which demonstrates the entire process.
{{Specifications}}
{{Compat}}