获取发布者的离线消息

时间:2012-12-07 14:28:29

标签: xmpp publish-subscribe openfire bosh

我使用XEP-0060实现了openfire pubsub,我可以通过现有节点发布消息,并且我有其他订阅者可以获取这些已发布的消息。

现在的问题是,我无法接收旧消息,我的意思是如果订阅者处于离线状态,当他们重新上线时,我怎样才能获得发布者长时间发布的旧消息。

发布者发布的节点配置如下

<iq from="pubsub.example.com" type="result" id="meta1" to="lime@example.com/localhost">
<query xmlns="http://jabber.org/protocol/disco#info" node="mynode/loc">
<identity category="pubsub" type="leaf"/>
<feature var="http://jabber.org/protocol/pubsub"/>
<feature var="http://jabber.org/protocol/disco#info"/>
<x xmlns="jabber:x:data" type="result">
<field type="hidden" var="FORM_TYPE">
<value>http://jabber.org/protocol/pubsub#meta-data</value>
</field>
<field type="text-single" label="Short name for the node" var="pubsub#title">
<value/>
</field>
<field type="text-single" label="Description of the node" var="pubsub#description">
<value/>
</field>
<field type="boolean" label="Allow subscriptions to node" var="pubsub#subscribe">
<value>1</value>
</field>
<field type="boolean" label="New subscriptions require configuration" var="pubsub#subscription_required">
<value>0</value>
</field>
<field type="boolean" label="Deliver payloads with event notifications" var="pubsub#deliver_payloads">
<value>1</value>
</field>
<field type="boolean" label="Notify subscribers when the node configuration changes" var="pubsub#notify_config">
<value>1</value>
</field>
<field type="boolean" label="Notify subscribers when the node is deleted" var="pubsub#notify_delete">
<value>1</value>
</field>
<field type="boolean" label="Notify subscribers when items are removed from the node" var="pubsub#notify_retract">
<value>1</value>
</field>
<field type="boolean" label="Only deliver notifications to available users" var="pubsub#presence_based_delivery">
<value>0</value>
</field>
<field type="text-single" label="Type of payload data to be provided at this node" var="pubsub#type">
<value/>
</field>
<field type="text-single" label="Message body XSLT" var="pubsub#body_xslt">
<value/>
</field>
<field type="text-single" label="Payload XSLT" var="pubsub#dataform_xslt">
<value/>
</field>
<field type="list-single" label="Specify who may subscribe and retrieve items" var="pubsub#access_model">
<option>
<value>authorize</value>
</option>
<option>
<value>open</value>
</option>
<option>
<value>presence</value>
</option>
<option>
<value>roster</value>
</option>
<option>
<value>whitelist</value>
</option>
<value>open</value>
</field>
<field type="list-single" label="Publisher model" var="pubsub#publish_model">
<option>
<value>publishers</value>
</option>
<option>
<value>subscribers</value>
</option>
<option>
<value>open</value>
</option>
<value>open</value>
</field>
<field type="list-multi" label="Roster groups allowed to subscribe" var="pubsub#roster_groups_allowed"/>
<field type="jid-multi" label="People to contact with questions" var="pubsub#contact"/>
<field type="text-single" label="Default language" var="pubsub#language">
<value>English</value>
</field>
<field type="jid-multi" label="Node owners" var="pubsub#owner">
<value>mypublisher@example.com</value>
</field>
<field type="jid-multi" label="Node publishers" var="pubsub#publisher"/>
<field type="list-single" label="Select entity that should receive replies to items" var="pubsub#itemreply">
<value>owner</value>
</field>
<field type="jid-multi" label="Multi-user chat room to which replies should be sent" var="pubsub#replyroom"/>
<field type="jid-multi" label="Users to which replies should be sent" var="pubsub#replyto"/>
<field type="boolean" label="Send items to new subscribers" var="pubsub#send_item_subscribe">
<value>1</value>
</field>
<field type="boolean" label="Persist items to storage" var="pubsub#persist_items">
<value>1</value>
</field>
<field type="text-single" label="Max number of items to persist" var="pubsub#max_items">
<value>5</value>
</field>
<field type="text-single" label="Max payload size in bytes" var="pubsub#max_payload_size">
<value>5120</value>
</field>
</x>
</query>
</iq>

1 个答案:

答案 0 :(得分:0)

是的,我知道了,当订阅者使用以下节目上线时,他/她可以检索旧的已发布项目

在这种情况下,

subid必须

<iq type='get'
    from='subscriber@example.com'
    to='pubsub.example.com'
    id='items1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <items node='mynode'
subid="8839399494949"/>
  </pubsub>
</iq>