I am using Strophe JS & Openfire to do simple pubsub.
Setup :
- OS: Windows 7
- Openfire : 3.7.0
- Strophe JS,Strophe plugin for pubsub.
- Tomcat 6:Serving webpage
Use case:
Two browser Window with two different user session(xmpp session)
Firefox(user1)---->Publisher
Chrome(user2)---->Subscriber
Code:
//XConn represents Strophe Connection
//creating PUBSUB NODE (Firefox)
XConn.pubsub.createNode(
XConn.jid,
'pubsub.localhost',
'PUBSUB_NODE',
{},
function (){
}
);
//Adding subscriber to created node (Chrome)
XConn.pubsub.subscribe(
XConn.jid,
'pubsub.localhost',
'PUBSUB_NODE',
[],
function(msg){ console.log(msg);},
function(sub){ }
);
//publishing item to node (Firefox)
XConn.pubsub.publish(XConn.jid,'pubsub.localhost','PUBSUB_NODE',[ '<item><book xmlns="pubsub:test:book"><title>Book1</title></book></item>']);
XConn.pubsub.publish(XConn.jid,'pubsub.localhost','PUBSUB_NODE',[ '<item><book xmlns="pubsub:test:book"><title>Book2</title></book></item>']);
I am expecting that both the messages published by publisher(firefox) should get printed on chrome(subscriber) console. But it just prints the first one, looks like Subscribe-callback gets called only once.