Last 50 messages with strophe MAM plugin

731 views
Skip to first unread message

Richard Phillips

unread,
Aug 21, 2015, 1:55:59 PM8/21/15
to Strophe

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. 

Luis Troya

unread,
Oct 12, 2015, 11:18:42 AM10/12/15
to Strophe
use before as this:
{
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

yash...@gmail.com

unread,
Jun 2, 2016, 9:26:17 AM6/2/16
to Strophe
where i put this code?
Reply all
Reply to author
Forward
0 new messages