about reconnect

Clarence Pan
Added about 4 years ago

Dear All,

 I'm trying to develop an chatting software on android equipment, using JAXMPP 2.X . And I would like to ask you that if there are any methods provided by JAXMPP 2.X to monitor the web connect status. Because I want to reconnect to the server when the web connect status changes. Thank you!

Replies (2)

Added by Wojciech Kapcia TigaseTeam almost 4 years ago

There are events for connected/disconnected:

jaxmpp.addListener(JaxmppCore.Disconnected, new Listener<JaxmppCore.JaxmppEvent> () {

    public void handleEvent( JaxmppCore.JaxmppEvent be ) throws JaxmppException {
        // code

Added by Clarence Pan almost 4 years ago

I've found a method like this:

jaxmpp.getConnector().addListener(Connector.StateChanged, new Listener<Connector.ConnectorEvent>() {

            public void handleEvent(Connector.ConnectorEvent paramAnonymousConnectorEvent) throws JaxmppException {
                // TODO Auto-generated method stub
                 state = jaxmpp.getConnector().getState();
                 if(state == State.disconnected){




But thank you also