Skip to content
ngTurn

Quickstart

Add ngTurn to any WebRTC app by listing its servers in your ICE configuration. There is no SDK to install.

  1. 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.

  2. 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)
  3. Open the TURN tester, paste the same URLs and credentials, and run it with relay-only gathering. A relay candidate means clients that need a relay will connect.

To test the relay path end to end, temporarily set iceTransportPolicy: 'relay'. Calls then connect only through ngTurn, which shows you exactly what users on locked-down networks experience.

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.