Project

General

Profile

Bosh reconnection

Vlad Buryj
Added about 2 years ago

Dear all.

We are using Tigase using BOSH. We have a problem with reconnection,after restart Tigase. We trying do that on different way. For example

jaxmpp.getEventBus().addHandler(Connector.StateChangedHandler.StateChangedEvent.class,
        new Connector.StateChangedHandler() {
            @Override
            public void onStateChanged(SessionObject sessionObject, Connector.State oldState, Connector.State newState)
                    throws JaxmppException {
                if (newState == Connector.State.disconnected) {
                    jaxmpp.login(true);
                }
            }
        });

and

    jaxmpp.getEventBus().addHandler(StreamTerminatedHandler.StreamTerminatedEvent.class, new StreamTerminatedHandler(){

                @Override
                public void onStreamTerminated(SessionObject sessionObject) throws JaxmppException {
                    // TODO Auto-generated method stub
                    jaxmpp.login(true);
                }

    });

and nothing did not help.

Maybe someone have some an idea how to solve that the problem.

Thanks, Best regards, Vlad


Replies (7)

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

Which version of Jaxmpp are you using?

(1)

Added by Vlad Buryj about 2 years ago

We are using 3.1.4 version, before we were using 3.1 version

Thanks, Best Regards, Vlad

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

In this case I would rather suggest to use JaxmppCore.LoggedOutHandler to detect disconnection.

It may be a good idea to slightly delay reconnection as during call of events mentioned above state may not be changed to disconnected yet, which will not allow for reconnection.

(1)

Added by Vlad Buryj about 2 years ago

Thanks. Now reconnect work good, but appear the new problem. After reconnect, client can not receive message and can not send message, all handlers was deleted after reconnect.

Thanks, Best Regards, Vlad.

Added by Vlad Buryj about 2 years ago

We noticed that after reconnect, that with private messages we dont have problem. Problem exists only for room messages

Thanks

Best Regards, Vlad

Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

After reconnect, client can not receive message and can not send message, all handlers was deleted after reconnect.

Could you clarify which handlers were removed? It would be best if you could provide sample code used for registration of handler which is not fired after reconnection.

We were using this method and haven't seen removal of event handlers or listener. In fact only listeners registered directly on Connector instances may be dropped as during reconnection new Connector instance is created.

Added by Vlad Buryj about 2 years ago

Thanks, for all we solved the problem!

Best Regards, Vlad

    (1-7/7)