python - Communicating to server with queries through stream. What is the right way? -


i'm writing first network application. manipulates jabber client , communicates service iq-stanzas. details not important.

this interaction works through twisted xmlstream (python language). typical situations described here: http://juick.com/help/api/xmpp/ short, can send "query" , server relies me "result".

i implemented basic actions "send message", "do action on message received". problem in operating stream. better use deferreds request data server? , how return result place needed?

you can through code here: http://bitbucket.org/boh/tmp/src/56c131cd1e62/juick_app/twisted_app.py tried make minimalistic.

to pair response reply, use iq.id attribute. can store few deferreds in cache indexed id , run them when reply. since xmpp tcp-based, replies in right order anyway. can cap cache , run deferred's errback if deferred has been in cache while.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -