How to get openfire chat room messages history

假如想象 提交于 2020-01-05 10:11:10

问题


I use Strophe library to connect to an OpenFire XMPP server.

How can I receive the chat room messages history ?

var o = {to:'roomName@conference.domain.com/youNick'}; 
var m = $pres(o); 
m.c('x', {xmlns : 'http://jabber.org/protocol/muc#user'}, null); 
connection.send(m.tree());

I get only 25 messages when I join room. How to get past 25 message of the chat room ?


回答1:


You should add a <history/> element: https://xmpp.org/extensions/xep-0045.html#enter-managehistory.

<x xmlns='http://jabber.org/protocol/muc'>
    <history maxstanzas='100'/>
</x>


来源:https://stackoverflow.com/questions/31786034/how-to-get-openfire-chat-room-messages-history

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!