p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional XMPP Programming with JavaScript and jQuery (http://p2p.wrox.com/forumdisplay.php?f=542)
-   -   How to tell another user's online status? (http://p2p.wrox.com/showthread.php?t=92905)

drayarms May 16th, 2014 05:22 PM

How to tell another user's online status?
 
What's the best way to find out the online status of another user whose jid is known? Well here is how I am attempting to go about it

1) Send initial presence
Code:

MyNamespace.connection.send($pres());
2) Send directed presence stanza to the desired user
Code:

MyNamespace.connection.send($pres({to: "desired_users_jid@jabber.org"}).c("x",{xmlns:"http://jabber.org/protocol/muc"}).up().c("show").t(chat));
3) Add a handler prior to the sending initial presence line.
Code:

MyNamespace.connection.addHandler(Mynamespace.on_send_my_presence, null, "presense",  null, null);
From this point on, I'm confused. How does the contact's client handle the incoming stanza from me, such that I know what his online status is? Or am I even going about this the right way? I don't want to use subscriptions and rosters.


All times are GMT -4. The time now is 12:15 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.