I'm building a simple web tool with the lattest Strophe.js to handle pubsub messages. I can create nodes, subscribe, see forms... but when I publish (with ok response from server) messages are never forwarded to subscribed clients
I'm using ejabberd server with docker rroemhild/docker-ejabberd It has BOSH, pubsub, admin... and seems to be very complete. I have tried also with an standard jabber ubuntu installation with the same results.
I log in with two users and in the first I can create a node, see subscriptions.
$('#create-node').bind('click', function () {
var pub = $iq({ type: 'set', to: pubsubUrl })
.c('pubsub', { xmlns: 'http://jabber.org/protocol/pubsub' })
.c('create', { node: nodeName() });
connection.sendIQ(pub, pubSuccess, pubError, 5000);
});
$('#list-subscriptions-node').bind('click', function () {
var pub = $iq({ type: 'get', to: pubsubUrl, from: jid() })
.c('pubsub', { xmlns: 'http://jabber.org/protocol/pubsub#owner' })
.c('subscriptions', { node: nodeName() });
connection.sendIQ(pub.tree(), pubSuccess, pubError, 5000);
});
With the second user I subscribe to a recently created node and I efectively see the second user subscribed.
$('#subscribe-node').bind('click', function () {
var pub = $iq({ type: 'set', to: pubsubUrl })
.c('pubsub', { xmlns: 'http://jabber.org/protocol/pubsub' })
.c('subscribe', { node: nodeName(), jid : jid() });
connection.sendIQ(pub, pubSuccess, pubError, 5000);
});
Finally I publish some message. I get an OK response from the server.
$('#publish-node').bind('click', function () {
var pub = $iq({ type: 'set', to: pubsubUrl, from: jid() })
.c('pubsub', { xmlns: 'http://jabber.org/protocol/pubsub' })
.c('publish', { node: nodeName() })
.c('item')
.c('x', {xmlns :'jabber:x:data', type: 'result'})
.c('field', {var : 'title'})
.c('value').t($('#node-event').val());
connection.sendIQ(pub, pubSuccess, pubError, 5000);
});
My full code app is this github repo in case you want to play/see all the code.
Now the question is, despite everything seems to be fine I cannot see any message from the server to subscribed clients to a pubsub node... I tested with MUC conversations and everything is fine. When I publish node messages those are never sent as messages to clients.
I've Checked with several examples and books and I cannot understand if I'm doing something wrong or it's a server configuration thing.
Any idea? Is there somewhere in the server where I can check what's going on under the hoods?
Some examples from my server calls. Confirming that a user is subscribed
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' from='pubsub.example.com' to='[email protected]/13675173711451438137658982' id='3:sendIQ' type='result'>
<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
<subscriptions node='4193886472'>
<subscription jid='[email protected]' subscription='subscribed' subid='5AB6AF973AC7E'/>
</subscriptions>
</pubsub>
</iq>
</body>
And here a succesfully published message
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' from='pubsub.example.com' to='[email protected]/13675173711451438137658982' id='5:sendIQ' type='result'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='4193886472'>
<item id='5AB6AFAB19CFD'/>
</publish>
</pubsub>
</iq>
</body>