How to make Web RTC work behind Symmetric NAT?

284 Views Asked by At

I've created 2 simple webpages (for peer 1 and peer 2) that exchange a few messages with WebRTC data channel. You need to manually copy-paste offer and answer between the webpages. After the answer is pasted back to peer 1 the connection is established and those messages are sent and received. But, it only works if both peers are behind normal NAT.

Therefore I tried to use TURN server. I tried self-hosted Coturn server and Xirsys turn service, but just couldn't get them to work.

The web pages on codesandbox are:

The sandboxes now have fake credentials for turn servers, but I used real ones (static) in my experiments.

So, if I use this sandboxes in symetric NAT, or I just force the use of turn server with config iceTransportPolicy: "relay", then it does not work - the connection does not open.

Question 1: What do I have to do to make it work?

Question 2: Can you make it work with your own TURN server (and iceTransportPolicy: "relay" config option?

0

There are 0 best solutions below