qxmpp
qxmpp copied to clipboard
idle timeout in QXmppServer
I've written an xmpp server using qxmpp. My server (more specific: the qxmpp server part) disconnects a client after 120 seconds not receiving anything from it. So the server relies on the client sending pings (either white space pings or according to xep-0199).
Now I have observed that pidgin sends xep-0199 pings and the jabber-net library sends whitespace keepalives, but (both) not after they have recently recevied anything from the server. So it is possible to "remotely timeout" a client by sending them a presence stanza or message every 30 seconds.
I havent found out whether/how I can change the 120 second timeout period or let my code take some action before actually disconnecting the client (besides changing qxmpp code).
The only solution/workaround with current version of qxmpp server I can think of is to implement and forcefuly enable XEP-0199 server2Client-Pings or to use XEP-0198 Stream Management if the client supports it.
Although it is explicitly allowed by RFC 6120 chapter 4.6.3. "Idle Peer" to close the stream in this case, it is not recommended:
Even if the underlying TCP connection is alive and the stream is not broken, the peer might have sent no stanzas for a certain period of time. (...)If the idle peer does not close the stream, the other party MAY either close the stream(...) However, consistent with the order of layers (specified under Section 13.3), the other party is advised to verify that the underlying TCP connection is alive and the stream is unbroken (as described above) before concluding that the peer is idle. Furthermore, it is preferable to be liberal in accepting idle peers, (...)
Could you imagine to add an onIdle handler giving my code the chance to send a ping to the client before actually disconnecting the client / would a pull request adding this have a change to be accepted?