Quickstart
Add zTurn to any WebRTC app by listing its servers in your ICE configuration. There is no SDK to install.
-
Get credentials
Section titled “Get credentials”Your dashboard shows a static username and password for testing and a shared secret for production. Use static credentials only while you build; ship time-limited credentials.
-
Add the ICE servers
Section titled “Add the ICE servers”List UDP first for the lowest latency, then TCP and TLS on 443 as fallbacks for strict networks.
ice-config.js const pc = new RTCPeerConnection({iceServers: [{ urls: 'stun:relay.ngturn.io:3478' },{urls: ['turn:relay.ngturn.io:3478','turn:relay.ngturn.io:80?transport=tcp','turns:relay.ngturn.io:443?transport=tcp',],username: credentials.username,credential: credentials.credential,},],});main.go config := webrtc.Configuration{ICEServers: []webrtc.ICEServer{{URLs: []string{"turn:relay.ngturn.io:3478", "turns:relay.ngturn.io:443?transport=tcp"},Username: username,Credential: credential,}},}pc, err := webrtc.NewPeerConnection(config) -
Confirm the relay works
Section titled “Confirm the relay works”Open the TURN tester, paste the same URLs and credentials, and run it with relay-only gathering. A
relaycandidate means clients that need a relay will connect.
Force relay to test your app
Section titled “Force relay to test your app”To test the relay path end to end, temporarily set iceTransportPolicy: 'relay'. Calls then connect
only through zTurn, which shows you exactly what users on locked-down networks experience.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause |
|---|---|
| Error 401 in the tester | Wrong or expired credentials. Time-limited credentials expire by design. |
| Error 701 on UDP only | The network blocks UDP. The TCP and TLS URLs should still work. |
| No relay candidates at all | A proxy blocks port 3478 and 80. Keep turns: on 443 in your list. |