Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to re-request room roster and history from a muc in ejabberd

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)

like image 717
Ollie Edwards Avatar asked Nov 05 '22 06:11

Ollie Edwards


1 Answers

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

like image 103
Andrejs Pankins Avatar answered Nov 09 '22 11:11

Andrejs Pankins