[PyXMPP] Custom protocol: message- or IQ-based?

cyberco cyberco at media2b.net
Sun Feb 18 20:55:02 CET 2007


Hi,

I'd like to implement a client-to-client messaging protocol on top of
PyXMPP, but I wonder if I should use standard messages, or IQ packets. The
content of my protocol will be YAML. I tried using IQ packets, but didn't
get it working. I was able to send out valid IQ packets, but always got an
error back.

CODE==================================

iq = Iq(from_jid=fromJid, to_jid=toJid, stanza_type='get')
queryNode = iq.new_query(ns_uri='http://www.company.com/app')
yamlNode = libxml2.newNode('yaml')
queryNode.addChild(yamlNode)
iq.set_content(queryNode)
self.stream.set_response_handlers(iq,self.onIqResult, self.onIqError,
self.onIqTimeout)
self.stream.send(iq)

/CODE==================================

This results in the following IQ packet:

<iq from="x at x.com/home" to="y at y.com" type="get" id="979308"><query xmlns="
http://www.company.com/app"><yaml/></query></iq>

and the following error:

<query xmlns="http://www.company.com/app"><yaml/></query>

I wonder if the namespace is the problem. Can I just use any namespace as
long as both clients know it?

A disadvantage seems to be that IQ packets are not stored if the other is
offline. Any other disadvantages?

Thanks for any advice.
2B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jajcus.net/pipermail/pyxmpp/attachments/20070218/19ef2855/attachment.html 


More information about the PyXMPP mailing list