IQ packets/custom data?

I’‘d like to send a packet containing some custom data from one client, to another (actually, back to itself). I’‘ve been trying to do this using IQ packets, but I haven’'t been able to get it working.

Basically I’‘ve got a packet interceptor that’‘s looking at all the traffic. When a message that meets my criteria comes in, I’'d like to send a message back to the sender containing some information.

If the sender is using a custom client, it will know how to handle that event. I’‘d rather not have to check client versions however, so I’‘d like to use something that would just be discarded by clients that don’'t know how to deal with it – if such a thing exists.

Any help on this would be greatly appreciated.


When your client sent the IQ packet, were you able to see that the packet went through you packet interceptor? Setting a break in your interceptor will help you see if it does. If it doesn’‘t then probably you didn’'t correctly register your class as an interceptor.

If it does and you haven’‘t been able to see your client receive the return packet from your interceptor, then probably there’‘s a logic error, or the packet your interceptor builds doesn’‘t follow the proper stanza construct, for example, missing routing information. Perhaps, you’'d want to post your codes here so that everybody could see what causes the problem.

Hi hallow,

Depending on exactly what you’'re wanting to do the the best thing might be to implement your own IQHandler “IQ handlers respond to IQ packets with a particular element name and namespace.” There are a number of classes in the Wildfire source that use IQ Handlers and that would make for a good starting point for your work.

Hope that helps,


I created a new empty ResultIQ packet, and once I worked out how to add an element and set it’'s attributes, I was golden.

IQ replyPacket = IQ.createResultIQ(new IQ());