【发布时间】:2014-11-08 17:26:10
【问题描述】:
我正在尝试使用 xmpp 服务器在 xmpp 服务器上存储持久性公共数据。理想情况下,用户将能够在服务器上存储一个节点,然后稍后检索该特定节点。这一切都是在 openfire 服务器上实现的,前端使用 strophe。
当我创建节点时,我使用这样的东西:
$iq({
type: 'set',
to: 'pubsub.ubuntu',
id: 'pubsubecreatenode1'
}).c('pubsub', {xmlns: Strophe.NS.PUBSUB})
.c('create', {
node: "princely_musings";
});
它返回一个带有创建节点的结果节,除非我已经创建了节点,在这种情况下它返回:
<iq id="pubsubecreatenode1" xmlns="jabber:client" type="error"
from="pubsub.ubuntu"
to="admin@ubuntu">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<create node="princely_musings"></create>
</pubsub>
<error code="409" type="cancel">
<conflict xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></conflict>
</error>
</iq>
我也使用这个发布到它:
$iq({
type: "set",
to: 'pubsub.ubuntu',
id: 'pub1'
}).c("pubsub", {
xmlns: Strophe.NS.PUBSUB
}).c("publish", {
node: "princely_musings"
}).c("item")
.c("object", {xmlns: "http://www.w3.org/2005/Atom"})
.h("somedata");
也返回一个成功的 IQ 结果节。
但是,当我去发现节点时,在请求特定节点 (princely_musings) 时出现 item-not-found 错误,或者在未指定节点时出现空列表。
$iq({
type: "get",
to: 'pubsub.ubuntu',
id: "disco1"
}).c("query", {
xmlns: Strophe.NS.DISCO_ITEMS
});
或者对于特定节点:
.c("query", {
xmlns: Strophe.NS.DISCO_ITEMS,
node: "princely_musings"
});
这些返回:
<iq id="disco1" xmlns="jabber:client" type="result"
from="pubsub.ubuntu"
to="admin@ubuntu">
<query xmlns="http://jabber.org/protocol/disco#items"></query>
</iq>
和
<iq id="disco1" xmlns="jabber:client" type="error"
from="pubsub.ubuntu"
to="admin@ubuntu">
<query xmlns="http://jabber.org/protocol/disco#items"
node="princely_musings">
</query>
<error code="404" type="cancel">
<item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></item-not-found>
</error>
</iq>
当我尝试创建现有节点时出现的冲突错误让我相信我将节点适当地存储在服务器上,但是我无法确定为什么我的发现 iq 节没有找到任何东西。这些调用中是否有我遗漏或配置错误的东西,或者我应该使用其他协议来执行此操作?
【问题讨论】: