Only certain messages will make use or return data about RSM. These will be listed in the manual with that entry.
RSM elements found in XMPP stanzas can be parsed and returned to the user as the third (optional) parameter in a callback, e.g.
socket.send('xmpp.pubsub.retrieve', data, function(error, items, rsm) { })
A RSM element such as this...
... <set xmlns="http://jabber.org/protocol/rsm"> <count>99</max> <first>item-123</first> <last>item-173</last> </set> ...
Will be turned into the following:
{ count: 99 first: "item-123", last: "item-173" }
In order to make use of RSM users must pass an rsm key as part of outgoing data. Please see the following examples:
var data = { rsm: { max: 20, before: 'item-21' } }
In XML this becomes:
... <set xmlns="http://jabber.org/protocol/rsm"> <max>20</max> <before>item-21</before> </set> ...
The keys which can be used in the rsm key are: before, after, max, and index.
By passing a value of true for either before or after will result in a self closing element being sent. This can be used to select the last and first pages respectively.