ICE (Interactive Connectivity Establishment) is the protocol used to connect 2 peers, it determines all the possible routes between the 2 peers and then ensures are connected. These routes are also known as Candidate Pairs, which is a pairing of local and remote transport address. These addresses can be the local IP Address, public IP Address or Relayed Transport Address. Each peer gathers all the addresses they want to use, exchanges them, and then attempt to connect.
The following events can be called when gathering Addresses
OnRTCLocalCandidate
The event is called when a new local candidate has been found.
OnRTCRemoteCandidate
The event is called when the websocket server sends a remote candidate to this peer.
OnRTCLocalDescription
The event is called when the TsgcRTCPeerConnection requires the local SDP
OnRTCRemoteDescription
The event is called when the websocket server sends the remote SDP to this peer.
When the peer sends binding requests to the other peer to test if can connect, the following events may be called
OnRTCCandidatePairNominated
When both peers can connect using this candidate pair, the event is called.
OnRTCCandidatePairFailed
When the peers cannot connect using this candidate pair, this event is called.
OnRTCConnect
This event is called when there is valid candidate pair and DTLS is not enabled.
If DTLS is enabled, this event is called after a successful DTLS Handshake.