powered by Jive Software

SmackDebugger class doesn't receive IQ request stanzas

In the Jitsi project’s Jicofo application, we use the Smack SmackDebugger class to listen for all XMPP traffic, and optionally log it. We subclass AbstractDebugger to do this.

To make the log cleaner and only log complete stanzas we receive, we ignore the output that’s produced by the getReader() reader (raw reads/writes), and instead log the output produced by getReaderListener() reader (complete stanzas).

However, this reader does not receive IQ request stanzas. It appears this is because the API is written as a Smack StanzaListener, and Smack’s AbstractXMPPConnection API has explicit code that blocks this:

                // The following returns makes it impossible for packet listeners and collectors to
                // filter for IQ request stanzas, i.e. IQs of type 'set' or 'get'. This is the
                // desired behavior.

Is this really the desired behavior for the SmackDebugger? If so, why? If not, can it be fixed?

We’re using smack-core 4.2.4 but master appears to be similar.

Responding to myself: actually, this is fixed in Smack 4.3.x, the interface to the debugger classes has changed.

I think you already found the answers you need. But just to provide some background: The idea is that people should be starting handling IQ requests in stanza listeners and instead use the relatively new IQ request handler API, as this API provides several advantages. It ensures that there is at most one handler for an IQ, and that an appropriate error response is sent if there is no handler.