0

My grasp of how WebRTC works is a little flaky, but I understand that if my device is unable to create a direct connection with another peer (due to NAT, firewalling, etc), a TURN server will be used as a relay.

Is there a public service I can use to find out if my device is using a TURN server or connected directly to another peer?

i336_
  • 1,813
  • 1
  • 20
  • 41
  • 1
    you could just install wireshark in one of the machines and check the IPs of incoming and outgoing packets – mido Aug 18 '15 at 01:49
  • 1
    another option( for chrome) is chrome://webrtc-internals/ – mido Aug 18 '15 at 02:06
  • For Firefox right click on the page and click on _inspect element_ and go to console tab. There you can see if the connection is established through relay server or P2P. – Tahlil Aug 18 '15 at 08:33
  • I definitely think I have a few errors in my understanding of networking; please bear with me here. A STUN server will give me my external IP address, no issues there. However, I'm behind a NAT (which is why the STUN server was needed) which has UPnP in readonly mode, so, if someone tries to directly connect to me, won't it fail...? I was looking for an external service to give me an immediate verification as to whether I was using a TURN server or not. – i336_ Aug 18 '15 at 08:39
  • I don't immediately recall where I read this, and I can't verify if it was Google, Mozilla or another group who did the research, but I recently learned that it was found that the majority of users didn't need to use a TURN server to establish a WebRTC link. It was the fact that it was possible for these metrics to be collected that prompted me to intuit that a checking service is likely to exist out there somewhere. – i336_ Aug 18 '15 at 08:41
  • 1
    In Firefox, go to `about:webrtc` and look at the ICE candidate pair that has 'Selected' set to `true`. If it says `(relay)` somewhere then TURN is used, otherwise not. – jib Aug 19 '15 at 05:27

1 Answers1

2

Are u talking about a native app? or web app?

For native app's the solution can be:

  • wireshark - easy to do easy to understand

For web app's u also can use the :

  • chrome://webrtc-internals/

If you have access to the code it self just change the links they will be something like this:

iceServers = {"stun://mystunserver.com","turn://myturnserver.com {user:**** ,password=****}"};

just remove the turn if you are able to make a call you are using stun.

take note that the servers are used in the order that they appear in the list so stun servers first turn after

i hope it helps

EDIT 1:

See this post i think this was the answer for you: How to check if WebRTC uses a relay server?

the only solution that i know is trying to connecto to a STUN server if it fails you are using TURN

For your second comment, yes you have that kind of statistics but they are released by companies that have their own STUN/TURN servers, like the company that i work, they should be something like ~85% of the times you use STUN (direct p2p) and ~15% you use STUN (relayed p2p).

i hope that your question is answered now any doubt just comment again i will be happy to help you

Community
  • 1
  • 1
  • Thanks very much for taking the time to reply. I do use Chrome, so I'll have a look inside `chrome://webrtc-internals/` next time I'm connected to the app I was using. I've added a couple of comments to my OP, which explain more the precise solution I'm looking for. – i336_ Aug 18 '15 at 08:42