Using pre-allocated socket in demo_audio_video_simple project

116 views
Skip to first unread message

Rafael M

unread,
Jan 26, 2015, 7:47:45 PM1/26/15
to eas...@googlegroups.com
I am new to the EasyRTC project so I'm sorry if I'm missing something obvious.

I'm trying to modify the demo_audio_video_simple project in order to use a pre-existing socket. I basically changed the code to create a socket by calling io.connect and then passed it to the easyrtc.useThisSocketConnection function. It works, but it only connects if the browsers are already open when the server starts. I'm not sure if this is a bug or if I'm missing anything.

I tried debugging it and I figured that when there's a pre-allocated socket the easyrtc.easyApp method never calls success nor failure callbacks. Looking into the code, I found that the connectToWSServer function only passes the success callback function to sendAuthenticate inside a "connect" event listener, but never actually calls it. The problem is that the "connect" event already happened if I'm using the pre-allocated socket. Adding a sendAuthenticate call inside the if(preallocatedSocketIo) block fixed it, but since I'm new to the project I'm not sure this is actually the solution.

Thanks in advance,
Rafael M.

Eric Davies

unread,
Jan 28, 2015, 1:13:03 AM1/28/15
to eas...@googlegroups.com
Are you using the beta branch or the master branch?
The beta branch has a number of fixes.

Rafael M

unread,
Jan 28, 2015, 7:01:11 PM1/28/15
to eas...@googlegroups.com
I was trying it on master branch, but I tried on beta and had the same result.

Eric Davies

unread,
Jan 30, 2015, 11:59:14 AM1/30/15
to eas...@googlegroups.com
I'll look into this weekend.

Eric Davies

unread,
Feb 1, 2015, 1:24:23 AM2/1/15
to eas...@googlegroups.com
I just tried it on the beta branch with the files (once copies into the appropriate demo directories) that you'll find in https://gist.github.com/EricDavies/4302484a860c54e092e5. It connected fine for me.

Press the "allocate socket" button first, and then press the "Easyrtc connect" button.  I recommend having the javascript console window open so you can see if the first button press resulted in any errors.

My suspicion is that you are still using the master branch. if you pulled down the beta branch, went into it's server_example directory and typed "npm install", you'd be short a few steps and just get the master branch installed by npm. What you need to do is (assuming MacOs/Linux, adapt for windows):

  • pull down the beta branch to a directory called "beta" (just so we reference it later)
  • mv beta/server_example server_example
  • cd server_example
  • npm install
  • cd node_modules
  • rm -rf easyrtc
  • mv ../../beta easyrtc
  • cd easyrtc
  • npm install
  • cd ../..
  • node server.js


      

Rafael M

unread,
Feb 2, 2015, 11:48:28 AM2/2/15
to eas...@googlegroups.com
Thanks for the reply, I'll try it tonight and let you know.
Reply all
Reply to author
Forward
0 new messages