So I am trying to develop a web application that has the capability to make video calls between users of the web application. Theoretically, Caller A can look in a directory in the web application, see that Caller B is online and make a video call. My question is how do you get the IP and port number of Caller B? I realize that this information needs to be exchanged via signaling but how does Caller A ever get their information to Caller B if they don't know what Caller B's IP or port number are?
The peers discover each other through the ICE protocol. This is part of the normal WebRTC connection establishment. ICE has methods to discover the necessary information like IPs and ports.
What you need to worry about is getting the ICE candidates from one peer to the other. You do this via your signalling server. Peer A is discovering ICE candidates and will surface them to you on the RTCPeerConnection
object; you take those candidates, send them to your server, the server sends them to peer B, where they must be incorporated into peer B's RTCPeerConnection
; and the whole thing in reverse as well. Once enough ICE candidates have been exchanged and a matching possibility has been discovered, the two peers will establish a direct connection.
The implementation of the signalling server is left up to you and your particular needs.