EasyRTC connection issues on ReLogin

293 views
Skip to first unread message

Abhishek Sharma

unread,
Mar 31, 2015, 9:19:05 AM3/31/15
to eas...@googlegroups.com
I am using EasyRTC with Nodewebkit and SailsJS.
  1. First time when user logs in, I call EasyRTC server setup in my node app which returns EasyRTC id and occupants.
  2. When user logs out, I am calling disconnect function which closes websocket connection.
  3. If user tries to login again, Error thrown was : Develop Error, Attempt to connect when already connected to socket server.
    Above message was fixed by adding additional checks in if condition in this.connect method, i.e.
    if (self.webSocket && self.webSocket != undefined && self.webSocket != null) {
                     console.error("Developer error: attempt to connect when already connected to socket server");
                     return;
    }

     Now I don't get above error but connection is not getting established with server, i.e. I am not getting occupants and on adding console in server code, it was not showing any messages indicating that call was not made to server.
    If I reload app, it works but on relogin it does not.

Could you please help me in fixing issue or Let me know If I have made any mistakes?  


Eric Davies

unread,
Mar 31, 2015, 11:41:42 AM3/31/15
to eas...@googlegroups.com
Problem confirmed on the beta branch. I'll look into it sometime in the next few days.

Arun Aravind

unread,
May 9, 2015, 10:59:53 AM5/9/15
to eas...@googlegroups.com
Hi Eric,

I am also facing developer error issue can you please help its very very urgent

Thanks
Arun

Eric Davies

unread,
May 11, 2015, 1:00:27 AM5/11/15
to eas...@googlegroups.com
I've just tried disconnecting and reconnecting using the demo_audio_video demo on the beta branch (since that is where bugfixes go first). It seems to work fine. The only caveat I can think of is that you may need a short interval before connecting after a disconnect.

If you are having problems, please submit some code that demonstrates the problem. My time is limited, so something I can unzip into my demos or static folder and simply run is mandatory.

Arun Aravind

unread,
May 11, 2015, 4:00:04 AM5/11/15
to eas...@googlegroups.com
Thanks Eric,

we have developed the app using demo video audio . Already the app is in live.Is there any way to share the code with you prtivaely .

Arun


Arun Aravind

unread,
May 11, 2015, 5:35:09 AM5/11/15
to eas...@googlegroups.com
Hi ERIC,

below is the connection code that we have using in our APP please tell if anything went wrong.We are stuck with this issue ..


function connect_customer(nam) {

easyrtc.setSocketUrl(":8080");
var localFilter = easyrtc.buildLocalSdpFilter( {
        audioRecvBitrate:20, videoRecvBitrate:15
    });
    var remoteFilter = easyrtc.buildRemoteSdpFilter({
        audioSendBitrate: 20, videoSendBitrate:30
    });
    easyrtc.setSdpFilters(localFilter, remoteFilter);
easyrtc.setUsername(nam);
    easyrtc.setAcceptChecker(function(easyrtcid, callback) {
        document.getElementById('acceptCallBox').style.display = "block";
        callerPending = easyrtcid;
        if( easyrtc.getConnectionCount() > 0 ) {
            document.getElementById('acceptCallLabel').innerHTML = "Drop current call and accept new from " + easyrtc.idToName(easyrtcid) + " ?";
        }
        else {
            document.getElementById('acceptCallLabel').innerHTML = "Accept incoming call from " + easyrtc.idToName(easyrtcid) + " ?";
        }
        var acceptTheCall = function(wasAccepted) {
            document.getElementById('acceptCallBox').style.display = "none";
            if( wasAccepted ) {
                easyrtc.hangupAll();
            }
            callback(wasAccepted);
            callerPending = null;
        };
        document.getElementById("callAcceptButton").onclick = function() {
      
        //responsefn(true);
            acceptTheCall(true);
        };
        document.getElementById("callRejectButton").onclick =function() {
            acceptTheCall(false);
        };
        
        //responsefn(true);
    });
//file share
easyrtc.enableDataChannels(true);
//file share
easyrtc.setPeerListener(addToConversation);  
 
  if(vi_stat==2){

easyrtc.enableVideo(false);
}

if(au_stat==2){
   easyrtc.enableAudio(false);
}
    easyrtc.setRoomOccupantListener(convertListToButtons);
//file share
easyrtc.setDataChannelOpenListener(function(easyrtcid, usesPeer) {
        var obj = document.getElementById(buildDragNDropName(easyrtcid));
        if (!obj) {
            console.log("no such object ");
        }
        jQuery(obj).addClass("connected");
        jQuery(obj).removeClass("notConnected");
    });
    easyrtc.setDataChannelCloseListener(function(easyrtcid) {
        jQuery(buildDragNDropName(easyrtcid)).addClass("notConnected");
        jQuery(buildDragNDropName(easyrtcid)).removeClass("connected");
    });

    easyrtc.connect("easyrtc.audioVideo", loginSuccess, loginFailure);
easyrtc.easyApp("easyrtc.audioVideo", "selfVideo", ["callerVideo"], loginSuccess, loginFailure);


}


Thanks

Eric Davies

unread,
May 12, 2015, 12:00:23 PM5/12/15
to eas...@googlegroups.com
I can't be certain of what your error is because you didn't send me the corresponding HTML.

However, I think your problem is in your last two lines of the javascript. You are calling easyrtc.connect as well as easyrtc.easyApp. easyrtc.easyApp already calls easyrtc.connect; the whole point of easyrtc.easyApp was to package together the common stuff needed by simple applications [getting the local media, connecting, assigning media streams to video objects, handling disconnections]. Get rid of your call to easyrtc.connect. When you need to reconnect, simply call easyrtc.easyApp again. 

You can find this demonstrated in the files contained in this gist  https://gist.github.com/EricDavies/908ca6451dbd6a26d93e
Reply all
Reply to author
Forward
0 new messages