When a user joins an ejabberd MUC, the server will send a full room roster and chat history to the user.
In my web based client I need to persist the room over page reloads. My problem is that I loose al the initial information when the page is unloaded.
ATM I'm working around this by serialising the roster and room history to json and storing it in a cookie. However, this is a really bad idea (tm) as I can very quickly exceed the 4k general cookie limit for rooms with alot of users.
So the question: How can I re-request the information the server sends a user on join, without actually rejoining a MUC?
One approach for rosters would be to send a query iq with a namespace of "http://jabber.org/protocol/disco#items" but this is incomplete as it doesn't provide presence information or any extended info (such as real jids for non-anonymous rooms)
On page unload you need send "presence unavailable"
On page load (rejoin to room) send "presence available" plus "history" request. For example,
<history maxstanzas=20 />
Reference to XEP-0045 scheme
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With