WebRTC
Debug your WebRTC app with webrtc-internals API trace
June 29, 2021
2 min

Debug your WebRTC app with webrtc-internals API trace

What is webrtc-internals?

webrtc-internals is great tool to debug your WebRTC app and find issues in your peer connection as well as issues in your ice servers. you can get this by URL : chrome://webrtc-internals. Also you can brief idea about parameters in this api by here

What are the methods of connection in WebRTC

There are main three ways that WebRTC allows connections,

  • P2P Connection (Direct)
  • Use of STUN Server (By finding public IP address)
  • Use of TURN Server (By relaying all media through it)

WebRTC mainly use ICE protocols to connect two peers, there are three main type of icecandidates,

  • host candidate (typ host)
  • serverreflexive candidate (typ srflx)
  • relay candidate (typ relay)

You can see these typ of candidates when your expand onicecandidate or addIceCandidate events in webrtc-internals.

webrtc-internals-01
webrtc-internals-01

Host candidate mainly use direct P2P connection and connected. Serverreflexive candidate were there when peer asked STUN server. Similar to it relay candidate were there when peer asked to TURN server.

Let’s look at how to find what server method got connected me or why I am failed to connect.

First thing you need to have stun and turn servers when you connect your app remotely. If your TURN server works fine and if you connected through the turn server, you will get ’typ host’, ’typ srflx’, ’typ relay’ all three type of candidates on onicecandidate() api.

In this scenario, if you get only ’typ host’ and ’typ srflx’ and you got disconnected or chrome stops gathering candidates, then there is some error in your turn server. Since turn server configured by your there might not be a server side error. So main reasons might be server is not reachable or your credentials might be wrong. So you need to check those stuff if you got this kind of situation.

How to find current active connection

In this Scenario, you got connected without any errors, now you need to know what is the active connection and, how is the behavior of it. It is very easy because webrtc-internals highlight the active connection. So you can expand that and get some idea about it.

webrtc-internals-01
webrtc-internals-01

Hope you got brief idea about how to figure out, how to debug you WebRTC app with webrtc-internals and how to figure out the reasons to happen connection errors with turn servers and as well as, how to get information about current active connection.

If you like to read more about webrtc-internals, I recommended this.


Tags

WebRTCwebrtcwebrtc-internalsdebugging

Related Posts

WebRTC
WebRTC Basics - Chapter 1
July 16, 2020
2 min