Resources not working as expected

If I have two clients logged in as “user@server/client1” and “user@server/client2” (same user, different resources), and client1 sends an IQ packet to client2, what I’'m finding is that our Wildfire server (2.6.2) consistently delivers this packet back to client1 instead of to client2 (even though the “to” field clearly specifies client2).

This wasn’‘t the behavior I expected. I’'d thought using different resources would allow me to individually address multiple clients belonging to the same user… Is this not correct?


Hey Jim,

Most probably you are sending the IQ packet to the bare JID instead of the full user JID. IQ packets that do not include a resource will be handled by the server. On the other hand, IQ packets sent to a full JID (i.e. include a resource) will be forwarded to the target client (if available).

Hope that helps.


– Gato

Thanks Gato,

However, I definitely am using full JID’'s, which is what had me puzzled…

Here’‘s what I discovered after further testing: the behavior seems to depend on the order in which my two clients come online and the case of the resource portion of the JID’s. It turns out I had a lower-level method that was converting the “to” field in my outgoing IQ packet to lower case, so it didn’‘t exactly match the receiver’‘s JID which had some upper-case characters in it. In this scenario, if the receiver has come online before the sender, Wildfire acts as if it can’'t find the receiver and (incorrectly, I think) delivers the packet back to the sender. But if the receiver has come online after the sender, the packet is delivered correctly (even though the JID’s don’t exactly match by case).

This seems to indicate a slight consistency bug in Wildfire – presumably JID’s should either be case-sensitive or insensitive all the time, regardless of the order in which resources come online, yes? At any rate, the workaround is to make sure the “to” field in IQ packets always matches the case of the receiver’s JID exactly. This now appears to be working reliably for me, so I’m back in business!



More likely, this is due to a clients priority. Priority can be explicitly set using a presence stanza of type ‘‘available’’. If no matching resources are found, IQ stanzas will get directed to the highest priority.

Without looking at the code, I am assuming that Wildfire sorts its lists of registered resources per user by priority, and simply sends it to the first resource in the list.