---
title: "RTCIceCandidate | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Interface RTCIceCandidate

The **`RTCIceCandidate`** interface—part of the WebRTC API—represents a candidate Interactive Connectivity Establishment (ICE) configuration which may be used to establish an RTCPeerConnection.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate)

interface RTCIceCandidate {  
    [address](#address): string | null;  
    [candidate](#candidate): string;  
    [component](#component): [RTCIceComponent](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceComponent/) | null;  
    [foundation](#foundation): string | null;  
    [port](#port): number | null;  
    [priority](#priority): number | null;  
    [protocol](#protocol): [RTCIceProtocol](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceProtocol/) | null;  
    [relatedAddress](#relatedaddress): string | null;  
    [relatedPort](#relatedport): number | null;  
    [sdpMid](#sdpmid): string | null;  
    [sdpMLineIndex](#sdpmlineindex): number | null;  
    [tcpType](#tcptype): [RTCIceTcpCandidateType](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceTcpCandidateType/) | null;  
    [type](#type): [RTCIceCandidateType](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceCandidateType/) | null;  
    [usernameFragment](#usernamefragment): string | null;  
    [toJSON](#tojson-1)(): [RTCIceCandidateInit](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.RTCIceCandidateInit/);  
}

##### Index

### Properties[](#properties)

[address](#address) [candidate](#candidate) [component](#component) [foundation](#foundation) [port](#port) [priority](#priority) [protocol](#protocol) [relatedAddress](#relatedaddress) [relatedPort](#relatedport) [sdpMid](#sdpmid) [sdpMLineIndex](#sdpmlineindex) [tcpType](#tcptype) [type](#type) [usernameFragment](#usernamefragment)

### Methods[](#methods)

[toJSON](#tojson)

## Properties[](#properties-1)

### `Readonly`address[](#address)

address: string | null

The RTCIceCandidate interface's read-only **`address`** property is a string providing the IP address of the device which is the source of the candidate. The address is null by default if not otherwise specified.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/address)

### `Readonly`candidate[](#candidate)

candidate: string

The read-only property **`candidate`** on the RTCIceCandidate interface returns a string describing the candidate in detail. Most of the other properties of RTCIceCandidate are actually extracted from this string.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/candidate)

### `Readonly`component[](#component)

component: [RTCIceComponent](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceComponent/) | null

The read-only **`component`** property on the RTCIceCandidate interface is a string which indicates whether the candidate is an RTP or an RTCP candidate.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/component)

### `Readonly`foundation[](#foundation)

foundation: string | null

The **`foundation`** read-only property of the RTCIceCandidate interface is a string that allows correlation of candidates from a common network path on multiple RTCIceTransport objects.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/foundation)

### `Readonly`port[](#port)

port: number | null

The RTCIceCandidate interface's read-only **`port`** property contains the port number on the device at the address given by RTCIceCandidate.address at which the candidate's peer can be reached.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/port)

### `Readonly`priority[](#priority)

priority: number | null

The RTCIceCandidate interface's read-only **`priority`** property specifies the candidate's priority according to the remote peer; the higher this value is, the better the remote peer considers the candidate to be.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/priority)

### `Readonly`protocol[](#protocol)

protocol: [RTCIceProtocol](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceProtocol/) | null

The RTCIceCandidate interface's read-only **`protocol`** property is a string which indicates whether the candidate uses UDP or TCP as its transport protocol.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/protocol)

### `Readonly`relatedAddress[](#relatedaddress)

relatedAddress: string | null

The RTCIceCandidate interface's read-only **`relatedAddress`** property is a string indicating the related address of a relay or reflexive candidate.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/relatedAddress)

### `Readonly`relatedPort[](#relatedport)

relatedPort: number | null

The RTCIceCandidate interface's read-only **`relatedPort`** property indicates the port number of reflexive or relay candidates.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/relatedPort)

### `Readonly`sdpMid[](#sdpmid)

sdpMid: string | null

The read-only property **`sdpMid`** on the RTCIceCandidate interface returns a string specifying the media stream identification tag of the media component with which the candidate is associated. This ID uniquely identifies a given stream for the component with which the candidate is associated.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/sdpMid)

### `Readonly`sdpMLineIndex[](#sdpmlineindex)

sdpMLineIndex: number | null

The read-only **`sdpMLineIndex`** property on the RTCIceCandidate interface is a zero-based index of the m-line describing the media associated with the candidate.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/sdpMLineIndex)

### `Readonly`tcpType[](#tcptype)

tcpType: [RTCIceTcpCandidateType](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceTcpCandidateType/) | null

The RTCIceCandidate interface's read-only **`tcpType`** property is included on TCP candidates to provide additional details about the candidate type.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/tcpType)

### `Readonly`type[](#type)

type: [RTCIceCandidateType](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RTCIceCandidateType/) | null

The RTCIceCandidate interface's read-only **`type`** specifies the type of candidate the object represents.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/type)

### `Readonly`usernameFragment[](#usernamefragment)

usernameFragment: string | null

The read-only **`usernameFragment`** property on the RTCIceCandidate interface is a string indicating the username fragment ("ufrag") that uniquely identifies a single ICE interaction session.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/usernameFragment)

## Methods[](#methods-1)

### toJSON[](#tojson)

-   toJSON(): [RTCIceCandidateInit](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.RTCIceCandidateInit/)[](#tojson-1)
    
    The RTCIceCandidate method **`toJSON()`** converts the RTCIceCandidate on which it's called into JSON.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCIceCandidate/toJSON)
    
    #### Returns [RTCIceCandidateInit](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.RTCIceCandidateInit/)
