You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make sure Strophe is installed and the plugin is imported into your app. With RSM is available to do paged stanza requests like so:
require('strophejs-plugin-rsm');varconnection=newStrophe.Connection('wss://...');varoptions={before: '',isGroup: false,max: 50,};varmessages=[];varqueryid=connection.getUniqueId();varstanza=$iq({type: 'set'}).c('query',{xmlns: Strophe.NS.MAM, queryid });varnode=newStrophe.RSM(options);stanza.cnode(node.toXML());connection.addHandler((message: any)=>{varfin=getElementByTagName(message,'fin',Strophe.NS.MAM);varresult=getElementByTagName(message,'result',Strophe.NS.MAM);if(fin&&queryid===fin.getAttribute('queryid')){varpaging=newStrophe.RSM({xml: fin});// `paging` is now our paged RSM object with the following attributes:// paging.next()// paging.previous()// paging.toXML()// paging.fromXMLElement()returnfalse;}elseif(result&&queryid===result.getAttribute('queryid')){messages.push(message);}returntrue;},Strophe.NS.MAM);connection.sendIQ(stanza,null,null);