Am using ejabberd, with mod_mam - and strophe with mam plugin.
This is successfully retrieving ALL the messages for a user. What we are trying to do is retrieve only the LAST 50 messages.
Using the strophe mam "max": 50 setting returns just 50 messages, but it is the first 50 not the last.
The before 'RSM' setting requires we have the id of the last message - which we don't have because we have not yet queried MAM.
So the question is simply, how to get the last 50 jabber messages using strophejs mam.
{
with: jid,
max: 5,
before: '',
onMessage: function (message) {
console.log('message from history:', message);
},
onComplete: function (response) {
//your code here
}
}
This will retrieve only the last five message from a chat