Connection listener

New to smack library.

If the underlying socket connection is disconnected for some reason (e.g., network available), will it try to re-connect? Or is there an “event” that will be thrown that an application can listen?

Thanks

Yongwon,

You should check out the daily builds at:

The 1.2.0 release will also be out soon. Both have a new ConnectionListener feature that will allow you to be notified of connection closings or failures.

Regards,

Matt

Thanks alot for the quick response.

When will be this daily build become an official release?

aigoo,

It should be in the next few days, and perhaps even today if I can find time to clean up a few last items.

Thanks,

Matt

I have added a connection listener to my XMPP Bot which I want to always be connected to the server, now I’‘m just wondering what’'s the best solution, should I add some sort of wait before retrying to connect? How is it done in other clients / bots?

I’'d recommend trying to reconnect using a degrading polling interval. Ie, try once a every seconds for the first few seconds, then once every few seconds, then once every ten seconds, then once every minute, etc. This will provide good responsiveness in the general case, while not being a bad network citizen in the case that the server is down for an extended period of time.

Regards,

Matt