Is it right that Strophe.addHandler reads only first node from response?

Posted by markcial on Stack Overflow See other posts from Stack Overflow or by markcial
Published on 2010-05-26T11:37:54Z Indexed on 2010/05/26 11:41 UTC
Read the original article Hit count: 267

Filed under:
|
|

I'm starting to learn strophe library usage and when i use addHandler to parse response it seems to read only first node of xml response so when i receive a xml like that :

<body xmlns='http://jabber.org/protocol/httpbind'>
 <presence xmlns='jabber:client' from='test2@localhost' to='test2@localhost' type='avaliable' id='5593:sendIQ'>
  <status/>
 </presence>
 <presence xmlns='jabber:client' from='test@localhost' to='test2@localhost' xml:lang='en'>
  <status />     
 </presence>
 <iq xmlns='jabber:client' from='test2@localhost' to='test2@localhost' type='result'>
  <query xmlns='jabber:iq:roster'>
   <item subscription='both' name='test' jid='test@localhost'>
    <group>test group</group>
   </item>
  </query>
 </iq>
</body>

With the handler testHandler used like that :

connection.addHandler(testHandler,null,"presence");
function testHandler(stanza){
  console.log(stanza);
}

It only logs :

<presence xmlns='jabber:client' from='test2@localhost' to='test2@localhost' type='avaliable' id='5593:sendIQ'>
 <status/>
</presence>

What i am missing? is it a right behaviour? Should i add more handlers to get the other stanzas? Thanks for advance

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about xmpp