Test Connection every X seconds


I’'m new with Jabber. How can I test every XX seconds (or minute) if my connection is on? Is there an event and/or a message that describe this?

I need also to try to reconnect every XX seconds (if the connection to the server is down).

Thanks in advance.



Many clients and servers send whitespace in order to make sure that the TCP/IP connection is still active. Smack and Wildfire use this technique, in fact. If you want to do a more detailed test, you could send an IQ version request to the server (I use “example.com” below) and make sure you get a reply: