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
There are main three ways that WebRTC allows connections,
WebRTC mainly use ICE protocols to connect two peers, there are three main type of icecandidates,
You can see these typ of candidates when your expand onicecandidate or addIceCandidate events in webrtc-internals.
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.
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.
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.