Using Turn server in your JavaScript Code
Here is a sample Javascript Code with recommended configuration to allow through most firewalls, you can obtain the credentials by signing up for a free account.
var myPeerConnection = new RTCPeerConnection({
iceServers: [
{
urls: "stun:relay.metered.ca:80",
},
{
urls: "turn:relay.metered.ca:80",
username: "your-turn-server-username",
credential: "your-turn-server-password",
},
{
urls: "turn:relay.metered.ca:443",
username: "your-turn-server-username",
credential: "your-turn-server-password",
},
{
urls: "turn:relay.metered.ca:443?transport=tcp",
username: "your-turn-server-username",
credential: "your-turn-server-password",
},
],
});