I’d like to use the 0198 ack mechanism to ping the server, as a light-weight alternative to XEP-0199.
The current API exposes
XMPPTCPConnection.addStanzaAcknowledgedListener() which allows to track individual stanzas and
requestSmAcknowledgement() to send a “ping” to the server.
However, if there were no actual stanzas transmitted since the last
<r/>, the StanzaAcknowledgedListener won’t have any stanzas to acknowledge, and so it won’t be called.
I propose the following changes:
- implement an additional Listener API that is triggered on each element received from the server, returning the @h value.
- expose the currently expected @h value as a return value from
requestSmAcknowledgement()- this will allow to match the response to the that was requested by the client code.