Hector
Hector

Reputation: 5356

how to properly implement org.jivesoftware.smack.ConnectionListener

I am developing a GCM Cloud Connection Server (XMPP). I am using the suggested Smack API 4.0.6 library.

How should I implement each method defined by org.jivesoftware.smack.ConnectionListener

void    authenticated(XMPPConnection connection)
void    connected(XMPPConnection connection)
void        connectionClosed()
void    connectionClosedOnError(Exception e)
void    reconnectingIn(int seconds)
void    reconnectionFailed(Exception e)
void    reconnectionSuccessful()

The only examples I can find simply log out messages.

Whats the correct way to reconnect "cleanly" when my server looses its upstream connection?

Upvotes: 2

Views: 784

Answers (1)

Amedeo
Amedeo

Reputation: 312

Smack automatically tries to reconnect when it looses connection to your XMPP server.

Therefore, you are NOT required to implement all those methods, you can override some of them to extend their functionality.

Upvotes: 1

Related Questions