Overview of ICE for WebRTC

WebRTC is a suite of protocols that work together to enable real-time communication over the internet.  It is widely supported by internet browsers that use a JavaScript API to enable WebRTC communication in web applications.  One of the protocols used by WebRTC is the Interactive Connectivity Establishment protocol (ICE).  This protocol is used during session startup to establish which IP addresses and ports each WebRTC endpoint will send their RTP streams to.  ICE is run on each socket that an endpoint will use for RTP to establish a connection to the corresponding socket at the other end.

When ICE is started, each side gathers local candidates for each socket.  A candidate is an IP address and port pair that a remote endpoint might use to send data to the socket.  These can be gathered by querying local network interfaces, contacting STUN servers, or other methods.  Once the local candidates are gathered, they are sent to the remote end through an established communication channel, usually a websocket.  After the candidates are exchanged, each endpoint begins testing the candidates it received from the other side.  This is done by sending a simple request to the IP address and port and listening for a response.  If the expected response is received, the check for that candidate has succeeded.  Eventually, both ends must agree on which candidates will be used for communication.  Once this agreement is reached, the communication session can be started.

ICE for WebRTC

More Information