5

How can I get a the online presence of my "friends" using Strophe lib for JS? Not the roster, even the single presence ( or have I to do 1 req/user in roster? ) Usually I'm notified only at 'presence change' of every resource, but I want to know if a USER is online or offline ( like Pidgin ), without thinking about the many resources logged of each user that can be online simultanealy.

M4rk
  • 2,172
  • 5
  • 36
  • 70

1 Answers1

6

consider all users as offline by default. For all online user resources you get a presence notification automatically. You get all presence changes, and you get the initial after login for all your online contacts.

Alex
  • 4,066
  • 2
  • 19
  • 21
  • ok, but if someone is logged from 2 clients with the same account ( a2 as nickname ), and one of them get disconnected ( a2@localhost/first ), I receive the notification that the resource disconnected, but I don't know if it ( a2 ) has other resources ( like a2@localhost/second, a2@localhost/third ) online or not! How can I know? – M4rk Jan 21 '13 at 17:03
  • 1
    when a user is logged in with 2 resources, eg resource 1 = PC and resource 2 = Phone then you get 2 presence packets on login from this user. and . To assign a Presence to a user you have to check the from attribute. When one resource goes offline then you know that one is still online. – Alex Jan 21 '13 at 19:14
  • Do u know if there is already an implementation of it? thanks – M4rk Jan 21 '13 at 21:35
  • 1
    here in this book http://professionalxmpp.com/ and all the examples from the book https://github.com/metajack/profxmpp – Alex Jan 21 '13 at 21:48