Do you have set the ice servers, especially the turn server (or at least the stun server)? You have to pass a configuration object to the RTCPeerConnection-Constructor, which contains the field iceServers: [{urls: 'stun:some.stun.server.address},...]
Since it sounds to me like the ice gathering process checks the generated candidate addresses:
- It checks the local address (like 127.0.0.1) but since it is not running on the same computer, it fails.
- It checks the OS IP (something like 192.168.178.13, for example) and this will work, if the 2 computers are in the same network, but on different networks, those local IP's do not help...
- It makes a STUN request, asking an external server, what IP this request comes from. The Adress is different, since NAT does its job. Then it will try to connect with this reflexive address. For many NATs this will still not work, since incoming requests without previous outgoing connection to the IP will be forbidden
- It makes a TURN request, and routes the entire conversation through a relay server. This should work in nearly any case
If you did not set STUN and TURN servers in your config, step 3 and for won't be tried, because there will be no reflexive address from the stun server and no turn server relay address. Therefore, the ice gathering may end at step 2 (and be complete) but there will be no connection, since 1. and 2. will fail on different networks