Being connected to 2 applications at the same time.

97 views
Skip to first unread message

Daniel Andréasson

unread,
Apr 1, 2015, 6:20:56 AM4/1/15
to eas...@googlegroups.com

Hey.

In my example I'd like to be able to be connected to two different applications at once. Chat and video call. I'd like to be able to see everyone else that are logged in to the site and be able to call or chat them from either of the pages on the site (probably need a little work with accepting the call by either opening a new tab/window for the call itself or something like that).
As I've understood it, you can only be connected to one application at once, but multiple rooms? Or how does it work?

I'm attaching a picture of how our thoughts of having it is. A little button to toggle the chat/video-div so I can see other members online (don't mind the colours).

Thanks in advance.
2015-04-01 12_16_51-Video call.png

Daniel Andréasson

unread,
Apr 1, 2015, 6:22:50 AM4/1/15
to eas...@googlegroups.com
I forgot to add one thing. When someone logs on, I can see a button being created for the call-applicaiton but not for the chat.
Like in the attached file.
2015-04-01 12_21_58-Video call2.png

Eric Davies

unread,
Apr 1, 2015, 10:30:17 AM4/1/15
to eas...@googlegroups.com
For your purposes, it's probably sufficient if you have a single room that everybody joins (just like the demos have). That allows you to see and send text messages to whoever is logged on.
Individual video calls don't require individual rooms (rooms are really a discovery mechanism, a way to see a subset of the people logged in), but they may simplify your programming.

Daniel Andréasson

unread,
Apr 1, 2015, 10:56:00 AM4/1/15
to eas...@googlegroups.com
So I could have <body onload="connectToSpecificRoom(roomName)"> and both send messages over that room aswell as make calls to the other connected?
I just have to "copy paste" contents of demo_audio_video.js into whatever logic file I have for the chat?
Just add another button to the otherClients that calls performCall(otherEasyrtcid)?

Thanks for your fast reply. You guys seem great at that.
Cheers.

Eric Davies

unread,
Apr 1, 2015, 11:08:06 AM4/1/15
to eas...@googlegroups.com
Unless your code deliberately joins a room, the default behaviour is to join a room called "default", so you don't even need to worry about explicitly joining a room. Just connect to the server with the usual set of listeners as done by the demos.

It should be that easy :-).



Daniel Andréasson

unread,
Apr 10, 2015, 8:20:27 PM4/10/15
to eas...@googlegroups.com
Okay, I have a follow-up question that isn't necessarily easyRTC specific.

Our applicaiton handles authentication and joining of room through an external source (against database and with express-session variables etc).
A question I have regarding chat is if you know any good way to be able to print out the chat even if you change site (it resets due to the nature of how browsers work obviously).
We're using jade-engine to render pages, so all pages "look the same" in that regard (all divs are called the same for the popup-chat).

The question and idea I have is to handle it in the standard "get-route" in the application itself, to set the session variable to req.body.conversation or something like that.

Do you know if anything like this is possible?

My idea should look something like this:
app.use(function (req, res, next) {
   req.session.conversation = req.body.conversation;
   
next();
}
with:
body(onload="easyrtc.setUsername('#{session.username}'); connectToRoom('#{session.roomID}'); setChat('#{session.conversation}')")
in the layout-template on all sites where "setChat" sets the value of the session-variable into the conversation object on the site.

Thanks in advance
Daniel

Eric Davies

unread,
Apr 11, 2015, 3:37:33 PM4/11/15
to eas...@googlegroups.com
Outside my area of knowledge. 
Somebody else want to chime in?
You might want to take it to StackOverflow

Daniel Andréasson

unread,
Apr 12, 2015, 2:08:26 PM4/12/15
to eas...@googlegroups.com
Yeah I realized after I wrote that it has with node.js (express and express-bodyparser modules) to do with.
Will try to ask it on stackoverflow.

But I take it that there is no solution for it in easyrtc itself at the moment. Cause you get a new session ID every time you load a page, right?

Thanks for your response though.

Eric Davies

unread,
Apr 13, 2015, 12:25:22 AM4/13/15
to eas...@googlegroups.com
Everytime, you get a new easyrtcid. So the idea would be to write your own wrapper functions that mapped your permanent id's to easyrtcids so that the regular messaging still worked.

If you have a single application to write, that's not going to be too hard.

Daniel Andréasson

unread,
Apr 13, 2015, 2:34:05 AM4/13/15
to eas...@googlegroups.com
Yeah we do have an authentication process with sessions, so the swapping of session ID in easyrtc doesn't really matter too much.
Might look into writing my own functions to map the IDs to skip the randomness though.

I know I'm questioning alot, but I have one little question more.

For the easyApp application, how do I override easyApp.setAcceptChecker?
I want to do like you do in the demo_audio_video.js, so that you need to accept the call and not just get auto-accepted as long as you have a video-div to put the stream in.

I haven't figured out how to override it since it's inside the easyAppBody function and not accesible?

Eric Davies

unread,
Apr 13, 2015, 10:38:47 AM4/13/15
to eas...@googlegroups.com
Auto accepting happens because you haven't installed an acceptChecker.
SetAcceptChecker does that installation. Just call it with your checking function.


Daniel Andréasson

unread,
Apr 13, 2015, 12:22:25 PM4/13/15
to eas...@googlegroups.com
I am doing that. That is explicitly calling
easyrtc.setAcceptChecker( function(){
       
function to force accept/deny call
});
inside my own logic, right?

I fixed it by changing inside the easyAppBody function that calls setAcceptChecker (and always setting it to true).
self.setAcceptChecker(function(caller, helper) {
            var i;
            for (i = 0; i < numPEOPLE; i++) {
                var video = getIthVideo(i);
                if (videoIsFree(video)) {
                       helper(true);
                       return;
(Changed inside the if-case to my own logic to accept a call).

I've been trying to make a group-call feature, but I'm having problem fetching the streams that are already initiated in the call when a new participant is accepted.
My idea is to have it like the video call, one is the "host" and can add other members, every member joining the call will get the other feeds automatically setup.
I haven't found a function that returns the streams that are actively in the call, are there any for it?

Also, are there any variable / mapping of how the call was initiated from the beginning? To get the information about who started the call, if video/audio was enabled etc, so the next-coming peers won't start up with video feed if the host didn't start with it for example.


Eric Davies

unread,
Apr 14, 2015, 11:01:27 AM4/14/15
to eas...@googlegroups.com
I would suggest simply calling easyrtc.setAcceptChecker after you've called EasyApp, that way  you can move to new versions of easyrtc in the future without having to apply the same fix.
There are no functions that tell you who is in a conversation with who. This is something you could use the roomApiFields, if A is in a call with B, it can set a roomApiField to reflect that which other clients in the room could examine.
Reply all
Reply to author
Forward
0 new messages