06-06-2014 02:54 AM
Hi
I am sending message to other user using client.sendMesage(toUser,messageContent) , here if toUser is not logged to the cups then in sender side messages are getting echoed , i am trying to validate toUser status if its connected or not using the api client.getPrimaryPresenceForEntity(jid) , but here this method always returns null , please let me know if anything i need to do in order to check the connection status of the toUser before sending him message .
Regards
Shahzad
06-09-2014 07:15 AM
Hi Shahzad,
Please have a look to this url- https://developer.cisco.com/site/collaboration/jabber/websdk/learn/im-and-presence-how-to/use-jabber-im-core-apis/ for related information.
Thanks and Regards,
Geevarghese
06-10-2014 08:47 PM
Hi Shahzad,
You can get the roster entityset from the client and loop through the entities array as below. Then you get check the presence status for that given jid.
var client = new jabberwerx.Client('basic chat');
new jabberwerx.RosterController(client);
var jids = client.entitySet.toArray(); //Get the entitySet from current client
var rosterpresence;
var myentity = jabberwerx.RosterContact;
for(var i=0; i<jids.length; i++) { //Loop through the entitySet Array
myentity = jids[i];
if(myentity.identities == "") {
rosterpresence = myentity.getPrimaryPresence(); //Get primary presence from each RosterContact
if (rosterpresence) {
show = rosterpresence.getType() ||
rosterpresence.getShow() ||
"available";
status = rosterpresence.getStatus(); //Get the status of this entity, the Roster
}
show = " [" + show + "]" + (status ? "(" + status + ")" : "");
}
Regards,
Howard
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide