ruby-on-rails – XMPP4r – 无法检索脱机消息

栏目: Ruby · 发布时间: 6年前

内容简介:翻译自:https://stackoverflow.com/questions/14041204/xmpp4r-unable-to-retrieve-offline-messages

我正在尝试使用带有openfire服务器的ruby xmpp4r库获取openfire多用户组聊天记录.我能够构建请求,但我没有收到服务器回复.

以下是发现请求

iqr = Iq.new(:get,"example.com")
iqr.add_namespace("http://jabber.org/protocol/disco#info")
client.send(iqr)

这是框架的请求

<iq to='example.com' type='get' xmlns='http://jabber.org/protocol/disco#info'/>

但我没有得到服务器回复.我跟着XEP-0160和XEP-0013.

我在这里想念的是什么?

openfire是否提供聊天记录?那有api吗?

非常感谢任何帮助.而且我不太了解openfire,因此非常感谢任何关于它的信息.

据我所知,只有当房间被配置为持久化并设置为记录对话时,才能从房间中恢复聊天记录.服务器返回历史记录的天数也有限制.限制曾经是2天,但已经有 a longstanding discussion and some patches

来解决这个限制.

根据 another question 这里的SO,不能通过直接的HTTP请求来回溯历史记录而不首先通过单独的XMMP服务器代理历史记录,它是您尝试做的,还是您正在与Openfire服务器通信?

最后,它看起来像你想要的那样. According to the XMPP spec. 任何新用户在加入时都会收到房间的完整历史记录,前提是房间已配置为发送.因此,只需将正确配置的房间作为随机创建的用户加入,即可获得您正在寻找的历史记录.

因此,取决于这是否适用于您运行的服务,或者如果您尝试存档其他人的服务器,您的milage可能会持谨慎态度.如果您设置了服务器,它看起来是可能的,即使不是通过特定的API调用也是如此.如果服务没有你的控制,你可能会失去运气,因为历史可能根本就不存在……

希望能帮到你一点,即使我不能给出具体的解决方案.

服务发现

根据 documentation for service discovery ,您的请求未完成:

<iq type='get'
    from='romeo@montague.net/orchard'
    to='plays.shakespeare.lit'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

也许你应该 read up a bit 如何使用gem建立与XMPP服务的基本连接? This looks to be what you need 开始.他们有很多例子可以帮助你了解宝石细节……

翻译自:https://stackoverflow.com/questions/14041204/xmpp4r-unable-to-retrieve-offline-messages


以上所述就是小编给大家介绍的《ruby-on-rails – XMPP4r – 无法检索脱机消息》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Iterative Methods for Sparse Linear Systems, Second Edition

Iterative Methods for Sparse Linear Systems, Second Edition

Yousef Saad / Society for Industrial and Applied Mathematics / 2003-04-30 / USD 102.00

Tremendous progress has been made in the scientific and engineering disciplines regarding the use of iterative methods for linear systems. The size and complexity of linear and nonlinear systems arisi......一起来看看 《Iterative Methods for Sparse Linear Systems, Second Edition》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

html转js在线工具
html转js在线工具

html转js在线工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具