muaz-khan / RTCMultiConnection

RTCMultiConnection is a WebRTC JavaScript library for peer-to-peer applications (screen sharing, audio/video conferencing, file sharing, media streaming etc.)
https://muazkhan.com:9001/
MIT License
2.56k stars 1.38k forks source link

Trying to diagnose an issue where ICE never changes from gathering to complete #14

Open lepinsk opened 9 years ago

lepinsk commented 9 years ago

Hope this is an acceptable place to as a question. I've loved playing around with RTCMultiConnection. I've recently switched from using a free STUN/TURN server to one I'm running myself. My own server seems to work fine when connecting Mac -> Mac, but when trying to establish a Mac -> Windows connection, it doesn't seem to complete.

I've been adding a bunch of logging statements to the file to try to understand exactly what's going on, and why the connection never completes. In both the working test, I'm seeing ICE host candidates, however I'm only seeing srflx and relay candidates in the functional test; those are never getting logged in the non-functional test.

I'm running a stock Amazon EC2 server with the rfc5766-turn-server AMI; I don't know if this is some misconfiguration problem with my server, or something else.

Any idea how I can figure out why this session is never being properly established?

muaz-khan commented 9 years ago

Hoping that you configured iceServers like this:

connection.getExternalIceServers = false;
connection.iceServers = [{
     url: 'turn:domain.com:port',
     credential: 'password',
     username: 'username'
}];

connection.rtcConfiguration = {
    iceTransports: 'relay' // none || relay || all - ref: http://goo.gl/40I39K
};

Did you try to install TURN-server using this tutorial?

You can either use wireshark to check for STUN-binding requests to the TURN server, or otherwise, in the chrome://webrtc-internals page, you can check for following:

// https://cdn.webrtc-experiment.com/getConnectionStats.js
connection.onconnected = connection.onfailed = function(event) {
    event.peer && event.peer.getConnectionStats(function(result) {
        result.connectionType.local.ipAddress;
        result.connectionType.remote.ipAddress;
    }, 1000);
};
lepinsk commented 9 years ago

Hi Muaz,

Thanks for the quick reply. I've been actually working with RTCMultiConnection v1.4; that was the latest version when I first started working on this project.

Setting iceTransports to relay won't force all traffic to proxy through the TURN server, will it?

I'm going to take a look into these other things and report back. Thanks again.