orcajs / reflector

6 stars 4 forks source link

listen to peerConnection oniceconnectionstatechange to better detect disconnected? #3

Open boynet opened 9 years ago

boynet commented 9 years ago

righ now this scenerio is not detected: userA and userB connect using video and audio.

while talking userA lose internet connection(very common on mobile) userB will never know that userA dissconnected and the server will also never know to detect this and maybe a lot of others types.

if we listen to oniceconnectionstatechange than when one of the users lose internet connection the other one will know by the disconnected event

in orcaReflector.js in createWebRTCCall function add:

this.peerConnection.oniceconnectionstatechange = function() {
                status = this.iceConnectionState;
                switch (status){
                    case 'disconnected':
                        //This may be a transient state, e. g. on a flaky network, that can recover by itself.
                    case 'closed':
                        self.disconnect();
                }
            }
sharpie7 commented 9 years ago

This sounds like a good idea.

We haven't investigated the reliability, security and robustness of the reflector implementation. This version was built primarily as a demo/prototype and testing environment so it hasn't tried to address many cases that would be important in the real world.

boynet commented 9 years ago

ok thanks so for noobs you recommend to find other libary? what the reason behind not wanting to implement complete tested reflector? right now you have the best libary out there but I think that most of the people will have hard time of building thiere on reflector

sharpie7 commented 9 years ago

Several companies use Orca libraries internally but I think this is the only one available to the public. We are working with several companies to encourage more use of the Orca API in supported public development kits.

This reflector and library was created primarily to support a demo and to give other library developers a starting point for their libraries.