Request:
<iq type="get" id="page1">
<retrieve xmlns="urn:xmpp:archive" with="room@app.shmakov.voximplant.com" start="2015-07-01T09:35:48.646Z">
<set xmlns="http://jabber.org/protocol/rsm">
<max>0</max>
</set>
</retrieve>
</iq>
Response: (invalid)
<iq type="result" id="page1" to="222(app.shmakov)@voximplant.com/QIP">
<chat xmlns="urn:xmpp:archive" with="room@app.shmakov.voximplant.com" start="2015-07-01T09:35:48.646Z" />
</iq>
Should be valid
<iq type="result" id="page1" to="222(app.shmakov)@voximplant.com/QIP">
<chat xmlns="urn:xmpp:archive" with="room@app.shmakov.voximplant.com" start="2015-07-01T09:35:48.646Z" />
<set xmlns='http://jabber.org/protocol/rsm'>
<count>100</count>
</set>
</iq>
XEP-0059: Result Set Management
2.7 Getting the Item Count
In order to get the item count of a result set without retrieving the items themselves, the requesting entity simply specifies zero for the maximum size of the result set page:
Example 15. Requesting the Item Count
<iq type='set' from='stpeter@jabber.org/roundabout' to='users.jabber.org' id='count1'>
<query xmlns='jabber:iq:search'>
<nick>Pete</nick>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>0</max>
</set>
</query>
</iq>
The responding entity then returns the item count, which MAY be approximate rather than precise if determining the exact number of items would be resource-intensive:
Example 16. Returning the Item Count
<iq type='result' from='users.jabber.org' to='stpeter@jabber.org/roundabout' id='count1'>
<query xmlns='jabber:iq:search'>
<set xmlns='http://jabber.org/protocol/rsm'>
<count>800</count>
</set>
</query>
</iq>
Note: The element MAY be omitted, but only if it would be either impossible or exceptionally resource intensive to calculate reasonably accurate values.
Note: If there are no items in the full result set then the responding entity MUST return a response that adheres to the definition of the wrapper protocol (see Paging Forwards Through a Result Set).