I'm attempting to store persistent public data on an xmpp server using. Ideally, a user would be able to store a node on the server, and then retrieve that specific node later. This is all implemented on an openfire server, using strophe for the front end.
When I create the node, I use something like this:
$iq({
type: 'set',
to: 'pubsub.ubuntu',
id: 'pubsubecreatenode1'
}).c('pubsub', {xmlns: Strophe.NS.PUBSUB})
.c('create', {
node: "princely_musings";
});
which returns a result stanza with a create node, unless I've already created the node, in which case it returns:
<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>
I also publish to it using this:
$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");
Which also returns a successful IQ result stanza.
However, when I go to discover the nodes, I get an item-not-found error when requesting a specific node (princely_musings
), or an empty list when not specifying a node.
$iq({
type: "get",
to: 'pubsub.ubuntu',
id: "disco1"
}).c("query", {
xmlns: Strophe.NS.DISCO_ITEMS
});
and alternatively for a specific node:
.c("query", {
xmlns: Strophe.NS.DISCO_ITEMS,
node: "princely_musings"
});
These return:
<iq id="disco1" xmlns="jabber:client" type="result"
from="pubsub.ubuntu"
to="admin@ubuntu">
<query xmlns="http://jabber.org/protocol/disco#items"></query>
</iq>
and
<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>
The conflict errors that I arise when I try to create an existing node lead me to believe that I am appropriately storing the nodes on the server, however I can't determine why my discovery iq stanzas are failing to find anything. Is there something I'm missing or have misconfigured in these calls, or is there another protocol I should be using for this operation?