powered by Jive Software

Q: Presence Trouble in Servlet Application

hi ,

I have built a servlet-based jabber client with smack-1.4 in recent days. Everything seems ok except for one problem that puzzles me:

when more than one user, say two users, login to the application, the two then add the other to its roster separately, but only one of them can see the online presence of the other. I have already set SUBSCRIPTION_ACCEPT_ALL. Is PresenceListener thread-safe?

or smack only supports single-user client?

could anyone help me thanks!

gemini,

Smack supports several clients connected to the server at the same time. Try opening a debugger to find out the packets that Smack is receiving from the server. If you want you can post the XML packets so we can take a look at them.

Regards,

– Gato

Hi, Gato,

Thanks for your remind of debugging packet. I got the answer. Though I have set the SUBSCRIPTION_ACCEPT_ALL in the program, when client A adds client B to its roster, client B only replies SUBSCRIBED packet to client A’‘s request, but NOT automatically sends SUBSCRIBE packet to client A. That’‘s why B always see A offline. If B wants to see A’'s status automatically when A adds B to roster, B needs the ability to activate SUBSCRIBE-TO packet when B receives SUBSCRIBE-FROM packet, right? The coding work is to implement the PacketListener to realize this case, am I correct?

best regards