I'm writing my first network application. It manipulates jabber client and comunicates with some service with IQ-stanzas. But details are not important.
This interaction works through twisted xmlstream (python language). Typical situations are described here: http://juick.com/help/api/xmpp/ To be short, I can send a "query" and server relies me with "result".
I implemented some basic actions like "send message", "do action on message recieved". The problem is in operating with stream. Is it better to use deferreds to request any data from server? And how to return the result to the place where it is needed?
You can look through my code here: http://bitbucket.org/boh/tmp/src/56c131cd1e62/juick_app/twisted_app.py I tried to make it minimalistic.