ICE (Interactive Connectivity Establishment)
ICE (Interactive Connectivity Establishment) is a framework used to discover the best network path between two peers. It is used in WebRTC to set up real-time media streams over potentially complex network topologies.
Since clients might be behind NATs or firewalls, they need to determine their public-facing network addresses. So-called ICE candidates carry this network connectivity information.
ICE candidates are:
- Host Candidates: Direct IP addresses from client's network interface.
- Server Reflexive Candidates: Public IP+port by STUN server (for NAT clients)
- Relayed Candidates: Provided by TURN server when direct connectivity fails
- Peer-Reflexive Candidates: Addresses discovered during ICE connectivity checks
A peer's candidates are sent to the remote peer as part of the signaling process. ICE then performs connectivity checks to determine which pair of candidates works best for media transmission.