powered by Jive Software

Capturing iq packets

Is there a listener for capturing iq packets coming from the server? I haven’'t had any luck in finding documentation about it. Thanks.

If you are coding for the Spark client, then something like the following code would work for you.

// Filter for IQ Packets of type **** = “ERROR”, “GET”, “SET”, or “RESULT”

PacketFilter iqFilter = new IQTypeFilter(IQ.Type.****) {

public boolean accept(Packet packet) {

//enter code here for you



// Creates a packet listener.

PacketListener myListener = new PacketListener() {

public void processPacket(Packet packet)


//Enter code here for you

//System.out.println("***Packet contents:" + packet.toXML());



SparkManager.getSessionManager().getConnection().addPacketListener(myListener, iqFilter);

Perfect. Thanks alot. I forgot to check the smack docs.