powered by Jive Software

A question about order of openfire responses and queue


Does openfire replies to a client request on the same context or in the order of some queued replies.

For example, if a client is subscribing to some user presence and in the exact same time someone is sending him a message will openfire reply to the presence request right after the request or will it reply to the presence request with the sent message and only in the next round reply to the request?


I believe that it will reply to the presence request first, and then the message request. Is there a particular reason that you would want it the other way around?

Thank you for your answer.

Im trying to modify a client and its important for me to know if I should handle some client side queue or just handle pairs of requests and responses.

Hey dror,

Clients may get stanzas (i.e. Presence, IQ, Message) in any order. So for instance, if your client sends an IQ with ID=4 to the server itself and a message to a user then your client may get 3 messages from different people, an IQ reply for your IQ with ID=4 and more messages after that. That means that your client should not halt waiting for a reply to an IQ packet that it sent since you may get any other packet in the meantime. IQ packets have an ID that identifies the pair so they can safely be sent in an asynchronous way.


– Gato

Thank you.

You saved me allot of trouble.

Hi dror,

I don’t share the same thought as lee. Except for some very few incidents, XMPP is mostly about asynchronous messaging. Your client should be ready to accept any kind of packets that come in randomly. Although the order of request-respond holds true most of the time, you can’t expect that you’ll receive the respond right after the request. To support the fact on asynchronous nature even more, openfire runs several threads, each of which handles tasks independantly. Generally speaking, a thread that handles won’t wait for another that handles and vice versa.

Hope that helps.

Ooops, I’m a bit too late. As usual, Gato is ahead of me. Anyway hope this is useful.

Message was edited by: aznidin


so I may add that it is sometimes necessary for the client to wait for the reply of a message before sending other messages, e.g. when you set a privacy list your client should wait until the server did accept it as otherwise presence or message packets may leak.



Can I at least assume the order of responses on the authentication process?

Thank you all for your answers.


Can I at least assume the order of responses on the authentication process?

if you are using a Connection Manager, then the answer is ‘no’ - see JM-835. I did never hear of problems when you are connected directly to the server.