Open Relay: Free WebRTC TURN Server
Need a Paid TURN Server?
Metered also offers a paid TURN server. You can view the website here:
Paid TURN server by MeteredWhat is a TURN Server?
WebRTC TURN Server is required to relay the traffic between the peers when direct connection cannot be established among them.
WebRTC protocol establishes a direct connection between the peers, but the sometimes a direct connection cannot be established for this a TURN Server is required to relay the traffic between the peers.
As peers cannot directly connect to each other the TURN Server acts as an intermediary among the peers and forwards the traffic from one peer to another.
All the traffic (video/audio + data) that passes through the TURN server is already end-to-end encrypted by the peers and the TURN Server cannot decode/read the encrypted packet, it just relays the packet to other peers.
Overview
Open Relay is a free TURN server provided by Metered Video that you can use in your WebRTC applications. The Open Relay TURN server is highly available, reliable and offers both STUN and TURN Capabilities.
The Open Relay runs on port 80 and 443 to bypass corporate firewalls, many corporate/enterprise firewall only allow port 80 or 443, it also supports turns
+ SSL for maximum compatibility.
- ✅ Runs on port 80 and 443
- ✅ Tested to bypass most firewall rules
- ✅ Enterprise grade reliability (99.999% uptime)
- ✅ Support TURNS + SSL to allow connections through deep packet inspection firewalls.
- ✅ Support STUN
- ✅ Supports both TCP and UDP
- ✅ Dynamic routing to the nearest server
- ✅ Production Ready
✨ How to use
You can use the Open Relay TURN Server in your Javascript Code.
To use the TURN Server you will have to call the TURN Server REST API, the TURN Server REST API will return the iceServers
array that you
can use in the front-end.
The REST API automatically returns iceServers
that are nearest to the geo-location of the user for the lowest latency.
info
To obtain your API_KEY
sign-up for a free account.
Using the JavaScript Fetch() API
var peerConfiguration = {};
(async() => {
const response = await fetch("https://yourappname.metered.live/api/v1/turn/credentials?apiKey=API_KEY");
const iceServers = await response.json();
peerConfiguration.iceServers = iceServers
})();
var myPeerConnection = new RTCPeerConnection(peerConfiguration);
Using Axios
var peerConfiguration = {};
(async() => {
const response = await axios.get("https://yourappname.metered.live/api/v1/turn/credentials?apiKey=API_KEY");
const iceServers = response.data;
peerConfiguration.iceServers = iceServers
})();
var myPeerConnection = new RTCPeerConnection(peerConfiguration);
🔓 Credentials
To Connect to the Open Relay TURN Server, you need to sign-up for a free account and obtain your API Key.
Using the API you can call the end-point to fetch the iceServers
array that you can use in the RTCPeerConnection
.
🔐 Static Auth
Services like Nextcloud Talk or Matrix+Synapse+Riot uses static auth instead of username and password authentication for the TURN Server.
To use the TURN Server with those services use the static auth url which is staticauth.openrelay.metered.ca
secret: openrelayprojectsecret
TURN Server for Nextcloud Talk
Open Relay Project also works with Nextcloud talk, follow the instructions below to learn how to configure Nextcloud talk to work with Open Relay.
Nextcloud talk require the auth-secret-authentication
so we have to use the Open Relay Project's TURN Server with auth-secret-authentication.
Use the turn server url staticauth.openrelay.metered.ca
with Nextcloud talk and turn secret: openrelayprojectsecret
.
- Go to
Nextcloud-> Settings -> Talk
and under TURN Servers press the + button - Then select
turn:only
- Under turnserver:port enter
staticauth.openrelay.metered.ca:80
- Under secret enter
openrelayprojectsecret
Add another entry for port 443
- Select
turn:only
- Under turnserver:port enter
staticauth.openrelay.metered.ca:443
- Under secret enter
openrelayprojectsecret
🧰 Testing the TURN Server
You can test the TURN Server using:
- Trickle ICE
- ICE Test
- Using JavaScript
Using JavaScript (Preferred)
Testing the TURN Server using JavaScript code is the correct method.
You can sign-up for a free account and obtain an API key. Then clone this repo: https://github.com/metered-ca/WebRTC-Example
Add your API_KEY
under line #2 client/webrtc.js
: https://github.com/metered-ca/WebRTC-Example/blob/master/client/webrtc.js#L2
Trickle ICE
Go to the Trickle ICE website at https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and enter the TURN Server credentials.
caution
Don't forget to turn:
or stun:
prefix and add port to the url. e.g: turn:openrelay.metered.ca:80
, turn:openrelay.metered.ca:443
, stun:openrelay.metered.ca:80
(don't forget to add turn: or stun: and :80 or :443 ).
ICE Test
Go to ICE Test website at https://icetest.info/ and enter the turn server URL and credentials to test.
🛡️Security
All the WebRTC traffic is end-to-end encrypted using DTLS-SRTP and the TURN server just relays the traffic. The TURN server only parse the UDP layer of WebRTC packet for routing purposes, and do not (and cannot) touch the DTLS encryption.
All the application layer data, include video and datachannel is encrypted using DTLS+SRTP and the TURN server cannot decrypt that data and it only relays the encrypted data among the peers.
You can read more about it here: https://webrtc-security.github.io/
To read more about the TURN proposed standard refer to RFC 5766
ℹ️ Contact
If you have any questions, comments or suggestions you can email us at contact[at]openrelayproject.org
🚀 Powered by Metered Video
Metered Video provides enterprise grade WebRTC video calling apis that you can use to create video conferencing applications that can scale upto thousands of simultaneous online users, with live streaming and recording capabilities.
Terms and Conditions
By using Open Relay Project Website or TURN server, you agree to our terms and conditions.