I have a webrtc application, it works fine, but for testing purposes, I need to test if my TURN server works, but because both the testing devices are within the same network, I am unable to test, thought below code would restrict candidates to only the ones using TURN server,
function onIceCandidate(event, targetSessionID, targetUserName) {
if (event.candidate) {
var candidate = event.candidate.candidate;
if(candidate.indexOf("relay")<0){ // if no relay address is found, assuming it means no TURN server
return;
}
sendMessage(candidate); // using socket.io to send to the otherside
...
but I noticed that( with much frustration), this does not work, because when peer is creating answer description,
....
a=candidate:0 1 UDP 2128609535 13.198.98.221 58779 typ host
a=candidate:0 2 UDP 2128609534 13.198.98.221 58780 typ host
....
this means, the communcation is direct and not through TURN server, am I correct in assuming this? Now, how do I force the webrtc to use the TURN server?