View Single Post
  #3 (permalink)  
Old December 5th, 2010, 01:24 PM
metajack metajack is offline
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts

Originally Posted by anamaria View Post
Everything worked just fine, but I experience a problem regarding the online presence list. When unloading, I do not send any presence stanza having the type "unavailable" because I do not want the other users to see that I go offline and come back online every time I do a page refresh. However, after attaching and requesting the roster again I can only see a list with all the contacts appearing offline (although some of them are for sure online).
Your application must preserve some amount of state about the connection. One of these bits of state is the JID, SID, and RID. Another is the presence status of contacts.

My question is if I can somehow request the other users to send their presence stanza, without actually announcing them that I go offline and then send again initial presence information that normally triggers them into sending me their presence stanza.
You can send presence probes manually to everyone on your roster, but that is not really advisable. People may be changing pages a lot, and sending lots of duplicate probes is probably not going to scale well.

Use local storage to store critical application state on the client side or find some way to store this server side (AJAX, XMPP's private xml storage, etc).