Reputation: 14769
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)
Upvotes: 5
Views: 2962
Reputation: 2680
Hmm. I don't have a solution for Roster, but on the history one, have you tried this?
<iq to="[email protected]" type="get">
<history xmlns="http://www.jabber.com/protocol/muc#history" start="1970-01-01T00:00:00Z" direction="forward" count="100" />
</iq>
Upvotes: 1
Reputation: 31
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 />
Upvotes: 1
Reputation: 683
Try leaving the muc room when page unload and re-send presence to the muc when page re-load.
Upvotes: 0