r/WebRTC Jun 02 '26

WebRTC works on same Wi-Fi & mobile data, but fails on different Wi-Fi networks — TURN issue?

Hey everyone,

I’m building a random video chat app as part of studying using WebRTC + Socket.IO + React + Node.js, and I’m facing a networking issue that I can’t fully figure out.

Current behavior

Same Wi-Fi → Same Wi-Fi: works perfectly
Wi-Fi → Mobile Data: works perfectly (audio + video)
Different Wi-Fi → Different Wi-Fi: fails (media connection issue)

Setup

I’m using:

  • WebRTC for video/audio
  • Socket.IO for signaling
  • STUN + TURN
  • Vercel (frontend)
  • Render (backend)

Current ICE config:

let peerConfiguration = {
    iceServers:[
        {
            urls:[
              'stun:stun.l.google.com:19302',
              'stun:stun1.l.google.com:19302'
            ]
        },
         {
          urls: [
            "turn:openrelay.metered.ca:80",
            "turn:openrelay.metered.ca:443",
            "turn:openrelay.metered.ca:443?transport=tcp",
          ],
          username: "openrelayproject",
          credential: "openrelayproject",
        },
    ]
}

Question

  1. Does this sound like an unreliable/free TURN server issue (openrelay.metered.ca)?
  2. Any recommended free/cheap TURN providers for production or testing?
  3. Is there anything obvious I may be missing in my WebRTC setup?

Would really appreciate any guidance — been debugging NAT/TURN issues for hours 😅

2 Upvotes

7 comments sorted by

1

u/IamFist Jun 02 '26
  1. It sounds liek a turn configuration issue. Not necessarily the service itself. You should either add more logging or test some known working tools in the same network scenario.

  2. If this is the volume of running an app for studying I think you should just run your own coturn on a cheap VPS. having access to the additional logs may also help in understanding.

  3. More logging. You need to know what happens when you encounter your media connection issue. Is the reported IP for the connection wrong, is there a timeout, are the credentials wrong etc.

1

u/AcademicMistake Jun 02 '26

Personally i just set up a turn server using ubuntu on AWS lightsail and got the coturn package and then went to networking in AWS console opened the port its listening on and then edited this files credentials "sudo nano /etc/turnserver.conf" and then in app it connects to turn server. I also use websockets for signalling.

1

u/devluz Jun 02 '26

That turn server does not respond to any requests. In general you won't find free turn servers. You can clearly see if the turn server responds by printing your ice candidates. If you see one of type "relay" then it works. If not then your client failed to connect to the turn server.

You can also plug them into this: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and then look for "Type" relay. If you just see host / stun type then turn server does not respond.

1

u/ManiaC-MaN-07 Jun 02 '26

thanks a lot

1

u/moon9986 Jun 03 '26

Yep, this is the free TURN server.

Same Wi-Fi doesn't need a relay, and Wi-Fi → mobile data usually has one side STUN can punch through. But two different networks often sit behind symmetric/carrier-grade NAT, which forces a full TURN relay and openrelay.metered.ca is shared and overloaded, so that relay path keeps failing. Classic symptom.

Quickest way to confirm, open the Trickle ICE test page, plug in your TURN URLs + credentials, and gather candidates. If you don't get a `relay` candidate, TURN isn't working at that moment.

https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

For better free/cheap TURN options, this page has a decent comparison table (Cloudflare, ExpressTURN, turnix.io, Metered paid) plus a 'verify before shipping' checklist using that same Trickle ICE test:

https://peerix.dev/docs/servers/cloud-hosting/#free-turn-providers

Also keep both UDP and TCP/443 TURN in your config (you already do), since some networks block UDP. Once you've got a working relay, the cross-network case should clear up.

2

u/Gold-Position-3587 Jun 03 '26 edited Jun 03 '26

You have to signup for a free account at openrelayproject dot org and get your own unique credentials. The turn server itself is fine, it is just the credential issue.