Host vs Server Reflexive vs Relay ICE Candidates

This article explains the technical differences between host, server reflexive (srflx), and relay (relay) ICE candidates within the WebRTC framework. We will examine how Interactive Connectivity Establishment (ICE) gathers these candidates, the distinct roles of STUN and TURN servers, and how WebRTC peers utilize these different candidate types to successfully traverse NATs and firewalls to establish a real-time connection.

What is an ICE Candidate?

In WebRTC, an Interactive Connectivity Establishment (ICE) candidate represents a potential network path (an IP address, port, and transport protocol) that a device can use to receive data. During the connection establishment phase, WebRTC peers gather and exchange these candidates to find the most efficient and reliable path for peer-to-peer (P2P) communication.

There are three primary types of ICE candidates used in this process, each generated through a different networking mechanism.


1. Host Candidates

A Host Candidate represents the actual physical or virtual network interface of the local device.


2. Server Reflexive (srflx) Candidates

A Server Reflexive Candidate represents the public IP address and port allocated to a device by a Network Address Translator (NAT) or router.


3. Relay Candidates

A Relay Candidate represents a public IP address and port hosted on a third-party server that relays traffic between the two peers.


Summary of Differences

Feature Host Candidate Server Reflexive (srflx) Candidate Relay Candidate
Origin Local network interface (NIC) NAT/Router public mapping TURN Server allocation
Required Server None STUN Server TURN Server
IP Address Type Private (typically) Public Public (TURN Server’s IP)
Connection Path Direct local connection Direct P2P over the Internet Mediated (routed through TURN)
ICE Priority Highest Medium Lowest