Question

I am working on Weemo JS API for video conference.

1) I need some technical help for identify online user for conference.
2) How can i pass data from caller to callee?
3) How online user can disconnected from cloud?

please provide some technical ref for same.

Thanks.

Was it helpful?

Solution

You can know if a user is online or not by using the weemo.getStatus('USER_UID') method.

  • (void) getStatus('USER_UID')

When 'USER_UID' is the value of the target user Uid (String).

You will need to use the weemo.onGetHandler(name, obj) callback to catch the answer.

Here is an example of how to get the status of a user with a 'USER_ID' equal to 'userTestStatus':

var weemo = new Weemo('AppId', 'Token', 'Type');

weemo.onGetHandler = function(name, obj) {
    switch(name) {
        case 'status':
            var uid = obj.uid;
            if(obj.value == 0) {
                console.log("User "+uid+" is offline with a status "+obj.value);
            } else {
                console.log("User "+uid+" is online with a status "+obj.value);
            }
        break;
    }
};


weemo.onConnectionHandler = function(message, code) {
    console.log("Connection Handler : " + message + ' ' + code);
    switch(message) {
        case 'sipOk':
            weemo.getStatus('userTestStatus');
        break;
    }
};

weemo.initialize();

FYI: In this example I used the getStatus in the onConnectionHandler after receiving a "sipOk" because I want to make sure that my user is completly connected before runing a getStatus. Once you user is connected to the Weemo Cloud you can execute a getStatus out of the onConnectionHandler.

Once connected you can disconnect your user by using the weemo.reset() method. This will disconnect your user from the Weemo cloud.

  • (void) reset()

The reset function is used in order to properly disconnect the user from the cloud, and be able to connect to the real-time platform with other credentials.

You can find more details in the documentation and sample code available on the Weemo github here.

You can also find the full Weemo JavaScript API here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top