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?
So I've figured this out. I should have been looking at the openfire database in ofPubsubItem to determine whether I had actually been creating items (I wasn't). This was directly because the default node configuration. The create IQ should've looked more like this:
$iq({
type: 'set',
to: 'pubsub.ubuntu',
from: 'create1'
}).c('pubsub', {xmlns: Strophe.NS.PUBSUB})
.c('create', { node: 'princely_musings' }).up()
.c('configure')
.c('x', {xmlns: 'jabber:x:data', type: 'submit'})
.c('field', {'var': 'pubsub#persist_items'}).c('value').t('1').up().up()
.c('field', {'var': 'pubsub#access_model'}).c('value').t('open').up().up()
.c('field', {'var': 'pubsub#publish_model'}).c('value').t('open')
i've solved this question,the problem is not whether there are items in table 'ofPubsubItem'
i send 'iq' to server 'pubsub.myserver' instead of 'myserver',thats the keypoint for openfire pubsub
<iq to='pubsub.myserver'
type='set'
id='create'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<create/>
</pubsub>
</iq>
thx anyway
Related
I am using openfire 4.6.0 using which I am querying for Inbox( XEP-0430: Inbox) messages but I am getting the following error. Whether the feature XEP-0430 is available in openfire?
IQ Query:
<iq id="7025d773-fb53-4afa-89de-3be4d7167277" type="get" xmlns="jabber:client">
<inbox xmlns="urn:xmpp:inbox:1"/>
</iq>
Response:
<inbox xmlns="urn:xmpp:inbox:1"/>
<error xmlns="jabber:client" code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
The list of supported protocol extensions of Openfire is published at https://download.igniterealtime.org/openfire/docs/latest/documentation/protocol-support.html. The extension that you are looking for, XEP-0430 'Inbox', is not listed there.
I'm using ejabberd 15.09 and have enabled archive management for every MUC in the server configuration like below:
mod_mam:
default: always
mod_muc:
## host: "conference.#HOST#"
access: muc
access_create: muc_create
access_persistent: muc_create
access_admin: muc_admin
default_room_options:
mam: true
persistent: true
public: true
Also inspection on the admin panel for Ejabberd shows that messages are getting archived as the number of elements in archive table goes up after each message is sent to the MUC. This is verifying that archiving is enabled for the session.
To query the server for message archive from MUC, I am sending this iq packet:
<iq type='set' id='testid1'>
<query xmlns='urn:xmpp:mam:1'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:mam:1</value>
</field>
<field var='with'>
<value>testmyroomnow#conference.ip/</value>
</field>
</x>
</query>
</iq>
Response received from the server doesn't contain any messages.
<message from='user#ip' to='user#ip/Gajim'>
<fin xmlns='urn:xmpp:mam:0' complete='true'>
<set xmlns='http://jabber.org/protocol/rsm'>
<count>0</count>
</set>
</fin>
</message>
This MUC already contains some messages but querying like above is not returning any message. It seems that the format of xml stanza is not correct. Either the format for sending JID for conference is not correct or something else.
Not sure what to do as I'm already using the latest version of Ejabberd which is showing to support archive of MUC. Other that what I'm doing here, I have no idea how to query a MUC archive from ejabberd server.
You need to query the MUC service for MUC archive. The user MAM service only stores message for one-to-one conversation.
Please also note that you are not using the latest ejabberd. As of today, latest version is 15.11. I recommend you use the latest one regarding MAM MUC, as several clarifications has been made to XEP-0313 and were added to latest ejabberd.
Here is example query, sending MAM query stanza to MUC room itself:
<iq type='set' id='juliet1' to='tech#conference.process-one.net'>
<query xmlns='urn:xmpp:mam:0' queryid='f27'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>10</max>
</set>
</query>
</iq>
I'm working on getting Jappix running. I'm using ejabberd as my XMPP server and I've got everything working except comments and viewing attachments - group chat, single chat, external authentication, private messages, friend lists, presence and other works as intended.
My configuration is the same as the one the Jappix project provides on their jappix/jappix-tools github repository. I have no errors in my ejabberd log, the only thing I got while debugging and digging everything up is that this is an example stanza sent to the server:
<iq xmlns="jabber:client" type="get" id="get_31-30" to="pubsub.mydomain.com" xml:lang="en">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
</iq>
And this is the response I get from the server:
<iq xmlns="jabber:client" from="pubsub.mydomain.com" to="arqu#mydomain.com/jappix (1378149270017)" type="error" id="get_31-30" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
And in Jappix I just get the usual "Service Unavailable" error message.
Additional info:
My BOSH is the internal one of ejabberd and works fine as far as i know, I've setup the reverse proxy and everything else to make it work. Still could be something related to this and not reaching the service on some other port maybe?
It looks like you do not have pubsub enabled/installed on your server.
Have you tried any other pubsub request?
I am working on a iOS chat application, so for media transfer to work i need to enable mod_proxy65, and i have enabled the same in ejabberd.cfg file with their default setting: {mod_proxy65[]}. on client side i am using the https://github.com/robbiehanson/XMPPFramework xmpp framework for iOS.
in TURNSocket.m i have used proxy candidate as dev.myserver.com in place of default jabber.org . now when I try to open the TURN connection, the series of iq received and sent are as follows:
SEND: <iq type="get" to="dev.myserver.com" id="A9876DD0-B13C-4DC7-B812-2A6E653288BC"><query xmlns="http://jabber.org/protocol/disco#items"/></iq>
RECV: <iq xmlns="jabber:client" from="dev.gungroo.com" to="smita#dev.myserver.com/24983171131368877324197828" id="A9876DD0-B13C-4DC7-B812-2A6E653288BC" type="result"><query xmlns="http://jabber.org/protocol/disco#items"><item jid="conference.dev.myserver.com"/><item jid="irc.dev.myserver.com"/><item jid="proxy.dev.myserver.com"/><item jid="pubsub.dev.myserver.com"/><item jid="vjud.dev.myserver.com"/></query></iq>
SEND: <iq type="get" to="proxy.dev.myserver.com" id="26D694FB-C679-478C-A3D1-A84B9A583534"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
RECV: <iq xmlns="jabber:client" from="proxy.dev.myserver.com" to="smita#dev.myserver.com/24983171131368877324197828" id="26D694FB-C679-478C-A3D1-A84B9A583534" type="result"><query xmlns="http://jabber.org/protocol/disco#info"><identity category="proxy" type="bytestreams" name="SOCKS5 Bytestreams"/><feature var="http://jabber.org/protocol/disco#info"/><feature var="vcard-temp"/><feature var="http://jabber.org/protocol/bytestreams"/><x xmlns="jabber:x:data" type="result"><field var="FORM_TYPE" type="hidden"><value>http://jabber.org/network/serverinfo</value></field></x></query></iq>
SEND: <iq type="get" to="proxy.dev.myserver.com" id="C60068A2-985C-4C5C-87B3-C9FFFB41FDF0"><query xmlns="http://jabber.org/protocol/bytestreams"/></iq>
RECV: <iq xmlns="jabber:client" from="proxy.dev.gungroo.com" to="smita#dev.myserver.com/24983171131368877324197828" id="C60068A2-985C-4C5C-87B3-C9FFFB41FDF0" type="result"><query xmlns="http://jabber.org/protocol/bytestreams"><streamhost jid="proxy.dev.myserver.com" host="10.212.103.159" port="7777"/></query></iq>
here is the problem, its returning me the internal ip address(10.212.103.159) of server dev.myserver.com, resulting in failure of making the TURN connection. why doesn't it return external ip address of proxy.dev.myserver.com ?
to be on the same page: proxy.dev.myserver.com and dev.myserver.com both points to same external ip. and the port 7777 is open at my server dev.myserver.com . anybody who have worked with the same, please help??
here is the last iq(sent and received) which shows the error message:
SEND
<iq type="set" to="smita1#dev.myserver.com/38303823331368691199448799" id="2D376DBF-D437-48C8-B0FF-B10A5CD73240">
<query xmlns="http://jabber.org/protocol/bytestreams" sid="2D376DBF-D437-48C8-B0FF-B10A5CD73240" mode="tcp">
<streamhost xmlns="http://jabber.org/protocol/bytestreams" jid="proxy.dev.myserver.com" host="10.212.103.159" port="7777"/>
</query>
</iq>
RECV
<iq xmlns="jabber:client" from="smita1#dev.myserver.com/38303823331368691199448799" to="smita#dev.myserver.com/278621573136869119737843" type="error" id="2D376DBF-D437-48C8-B0FF-B10A5CD73240">
<query xmlns="http://jabber.org/protocol/bytestreams" sid="2D376DBF-D437-48C8-B0FF-B10A5CD73240" mode="tcp">
<streamhost xmlns="http://jabber.org/protocol/bytestreams" jid="proxy.dev.myserver.com" host="10.212.103.159" port="7777"/>
</query>
<error type="cancel" code="501">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
it would be really great if someone can point me to the problem. Thanks!
This helped me to resolve the issue. xx.xx.xx.xx is my external ip:
{mod_proxy65, [{hostname, ["xx.xx.xx.xx"]}]},
Visit this ,I can give an idea [XMPPFramework - TURNSocket can't receive the data that sent by myself? ]
Also [http://xmpp.org/extensions/xep-0096.html],[ XMPP Sending/Receving file in iphone sdk ...? ]
I have an XEP-0114 based XMPP component that works fine with the Openfire server. Ejabberd however complains about it.
First thing it does (after having authenticated) is to indicate presence. It does so by sending this:
<presence from="tictactoe.komogvind.dk"/>
I get this reply
<presence type="error" to="tictactoe.komogvind.dk" xmlns:stream="http://etherx.jabber.org/streams">
<error code="400" type="modify">
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</presence>
What am I missing?