I am working on chat application and using ejabberd saas edition as xmpp server for it.I am using smack library ver-4.2.3,To keep connection alive i am using ping manager.Here is the code i am using.
//int i = 1;
// PingManager.setDefaultPingInterval(i);
PingManager.getInstanceFor(AppController.mXmpptcpConnection).setPingInterval(300);
I am using sticky-service also for connection, but when i keep my application open (ideal-state) for 15-20 mins then the connection is lost, so i am using ping manger to resolve this issue. Is there any other better way of doing it or ping manager is the only option?
did you get any specific error or stack trace in your log while connection closing?
Have you checked the ping manager working properly and IQ for ping is exchanging from server to client and does server responding for the ping intreval?
you might need to set debugger on to catch all type of the error occuring at smack.
If you server closing server forcefully then you must need to change the configuration.
Please post you log while connection is closing it will help us to understand better
Thanks for quick reply
I am sending a ping to the server after every 5 min, and we are using ejabberd saas edition as our server, I didn’t know it supports or not, if ping module is not support by our server, Is their is any other possible way to stay connected(keep connection alive)?
Is This is only possible way to stay connected means by pinging to the server
Hello,
Thanks for the Response
Our server is not supports ping module, so I want to send whitespace stanza to ejabberd server, how can I send whitespace keepAlive stanza to ejabberd server using smack