0

Originally I was using an openfire backend for my web-based chat client. But since its pep did not work with clustering, I had to migrate to tigase.

Chat works fine with tigase, I haven't gotten to the clustering part but am still stuck with getting my old services up. Note: I'm using strophe in my web app.

I am now trying to figure out how to get pep working with tigase. for pep with openfire, I just use the pep plugin with strophe and subscribe to another user's pep stream like such

myObj.connection.pep.subscribe(jid, node , 
    function( iq ){ console.log(' > on_pep_subscription to '+jid+' node '+node+' SUCCESS');console.log(iq)},
    function( iq ){ console.log(' > on_pep_subscription to '+jid+' node '+node+' FAIL');console.log(iq)},
    function (msg){/*handle callback here*/}

to publish i use these:

myObj.connection.pep.publish('http://jabber.org/protocol/mood', newMood, 
    function( iq ){ 
        console.log('- on_pep_publish to node "http://jabber.org/protocol/mood" SUCCESS'); console.log(iq);}, 
    function( iq ){ 
        console.log('- on_pep_publish to node "http://jabber.org/protocol/mood" FAIL');
        console.log(iq); alert('failed to publish mood pls try again');}); 

This used to work fine with openfire but one big difference is that with tigase I don't get a callback success subscription. when I publish users on my roster automatically get my stream (which is good). But the problem is that I can't specify a handler for this event using strophe.

If i have 2 users cef and miko and my domain is mydomain. when i publish a mood with miko I get the following on cef:

<body xmpp:version="1.0" xmlns:xmpp="urn:xmpp:xbosh" secure="true" xmlns:stream="http://etherx.jabber.org/streams" xmlns="http://jabber.org/protocol/httpbind" ack="2545114322" from="mydomain">
<message id="2939:sendIQ" to="cef@mydomain" type="headline" from="miko@mydomain/tigase-15">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="http://jabber.org/protocol/mood">
<item>
<status>sad</status>
</item>
</items>
</event>
</message>
</body>

I've tried creating a handler on my own just like I would with the roster.

myObj.connection.addHandler(function(m){console.info('IQ WAAHAHAHAH');console.log(m);},null,"iq");
myObj.connection.addHandler(function(m){console.info('MESSAGE WAAHAHAHAH');console.log(m);},null,"message");
myObj.connection.addHandler(function(m){console.info('PRESENCE WAAHAHAHAH');console.log(m);},null,"presence");

for this particular event none of my handlers are able to handle them but with firebug and google's inspect I see an entry in the network with the said stanzas.

but It doesn't seem to work. Does anyone have any idea?

Kunal Pal
  • 545
  • 8
  • 21
  • To clarify the question... I think I am getting the pep stanza's but how do I tell my app to handle this event. I know strophe has an addHandler event but why am I not getting it on message iq and presence? – user1117271 Dec 27 '11 at 10:33
  • I found the solution I read the pep plugin for strophe. I need to specify the jid id on who the event is coming from: Gab.connection.addHandler(function(m){console.info('PRESENCE WAAHAHAHAH');console.log(m);},null,"presence",null,null,JID); this works now. Thanks for reading. I hope this helps someone in the future – user1117271 Dec 27 '11 at 11:13

0 Answers0