Twitter Youtube Facebook Google+ Linkedin Vimeo RSS
Follow

How to check the status of a user?

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

  • (void) getStatus('USER_UID')

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

You will need to use the rtcc.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 rtcc =new Rtcc('AppId','Token','Type');

rtcc.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;}};


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

rtcc.initialize();