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


I am writing my first network application. It manipulates the jabber client and communicates with some service with IQ-stanzas. But the details are not important.

This interaction works through twisted XML stream (Python language). Common situations are described here: To be less, I can send a "query" and the server relies on me with "results".

I did some basic actions such as "Send Message", "". The problem is working with the stream. Is it better to use suspended to request any data from the server? And how to return the result to the place where it is necessary?

You can see your code here: I tried to minimize it.

To add a response with the answer, you use the iq.id attribute. You can put a delay in the cache indexed by ID and can run on receipt of the answer. Since XMPP is TCP based, you will get most answers in the correct order. You can cap cache and run deficiencies if deferred in the cash for some time.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -