Example doesn't work (anymore?) with google STUN servers for NAT traversal
Hello, thank you for your very useful project. After struggling several days I realized your example doesn't work in NAT traversal with google STUN servers. I don't know exactly why, but I followed a comment that suggested to change the servers. I configured it like this (urls found from list of public servers):
iceServers: [{ urls: ["stun:iphone-stun.strato-iphone.de:3478", "stun:stun01.sipphone.com"] }]
And your example worked perfectly allowing a client in a Full-Cone NAT to communicate with an AWS vm (Port-Restricted NAT). This was the single point of failure in my code. Reverting it to use google STUN and the example wasn't working anymore.
As a side node: I noticed you issue creation of data channel in both sides (client js and server cpp) which shouldn't be needed, as mentioned here. After cleaning this, I was able to establish data channel with STUN server just configured in the client.
I discovered what was the problem. Google servers weren't the problem: in some circumstances two STUN servers binded to different IPs and TCP ports are needed for NAT traversal[1].
I used the following two google servers in both client and server and the connection in my case worked flawlessly:
iceServers: [{ urls: ["stun:stun1.l.google.com:19302", "stun:stun2.l.google.com:19305" ] }]
[1] https://stackoverflow.com/questions/7594390/why-a-stun-server-needs-two-different-public-ip-addresses