问题描述
我正在使用 openfire版本4.0.1
使用openfire Rest Api 我已经在服务servicename中创建了群聊室. xx.xx.xxx.xxx.
Using openfire Rest Api i have created group chat rooms in the service servicename.xx.xx.xxx.xxx.
现在创建了正在发生的房间,一旦用户连接到xmpp服务器,所有的组消息都将返回给该用户,这会使应用程序卡住.
Now rooms are created what is happening , once user connect to the xmpp server all the group messages are receiving back to that user which makes application stuck.
我听说了群聊设置下的群聊历史记录设置.
I heared about Group Chat History Settings under group chat settings.
我已经截断了存储在openfire的 ofMessageArchive 表中的所有组消息.
I have truncate all the group messages which is stored in ofMessageArchive table of openfire.
仍然,当用户连接到xmpp时,即使我已从ofMessageArchive表中清除了所有消息,该用户也将收到他所属的所有组的所有消息.
Still, when user connects to the xmpp that user will receive all the messages of all the group which he is member with even though i have cleared all the messages from ofMessageArchive table.
如何防止那些通过xmpp来的消息?
How to prevent those messages which are comming through xmpp?
任何帮助都可以.
推荐答案
您必须指定Openfire版本.
You have to specify your Openfire version.
但是,对于Openfire 4.0.2
However, for Openfire 4.0.2
Groupchat历史,它基于数据库上的许多参数以及客户端上的一些参数.行为不是线性的.
Groupchat history it's based on many params on database and some on client.Behaviour it's not ever linear.
1)在表OFPROPERTY
的属性xmpp.muc.history.reload.limit
中(以天为单位,例如put 30表示过去30天")
1) in table OFPROPERTY
the property xmpp.muc.history.reload.limit
(this works in days, for example put 30 means "last 30 days")
2),对于每个serviceid,您可以具有(或不具有)0+值.例如,对于serviceid 1(conference
),没有参数,您将获得最后25条消息,或者可以通过db或以编程方式命名为history.type
并键入(all
以获取所有历史记录,对于none
您的情况)
2) in table OFMUCSERVICEPROP
, for each serviceid, you can have (or not) 0+ values. For example, for serviceid 1 (conference
), without params you'll get last 25 messages, or you can set by db or programmatically name history.type
and type (all
to get all the history, none
for your case)
3)使用smack API ,您可以在加入聊天时发送DiscussionHistory请求:使用此对象,您可以将所有参数(例如节数等)设置为0.
3) With smack API You can send a DiscussionHistory request while joining chat: with this object you can set to 0 all the parameters (like: number of stanzas and so on).
history.type
是设置的最高级别:只需将其声明为none
,就不会检索任何历史记录.
history.type
it's the top level one to set: just declare it as none
and no history will be retrived.
这篇关于从iOS和Android端连接到XMPP时获取所有组消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!