getUser API can be used to find out if a user is online and details like profile link, avatar and status message.
jqcc.cometchat.getUser('USERID','CALLBACKFN')
1. To check if user status
window.onload = function() {
jqcc.cometchat.getUser('1', 'checkstatus');
}
function checkstatus(data) {
console.log(data); // To see output using Firebug
if (data.s == 'available') {
alert('User is online');
}
}
2. To get all details of a user
function details(data) {
alert(data);
}
jqcc.cometchat.getUser('1', 'details');
Not finding what you need?
The CometChat team is here to help!