Project

General

Profile

Receiving off line messages when going back online.

Daniel Perrett
Added almost 2 years ago

Hello,

I'm new to the Tigase API and not familiar with it.

I have created a java program which receives message perfectly fine when its up and running. The thing is it may well crash of be stopped for some reason. If that is the case its important that it receives any missed messages while being offline as soon as it goes back online.

Anyway that the way I thought that it should work and I have tried experiments with other chat application and I see this does happen with them. But when I try the same experiments with my code I do not see any of the missed messages.

the logon code is below:

jaxmpp1.getModulesManager().register(new InBandRegistrationModule());

    jaxmpp1.getModulesManager().register(new MessageModule());

    try {

        jaxmpp1.getModulesManager().register(new MessageCarbonsModule());

    } catch (JaxmppException e1) {

        // TODO Auto-generated catch block

        e1.printStackTrace();

    }

    jaxmpp1.getEventBus().addHandler(MessageModule.MessageReceivedHandler.MessageReceivedEvent.class, messageHandler);

    jaxmpp1.getModulesManager().register(new MucModule());

    jaxmpp1.getModulesManager().register(new AdHocCommansModule());

    jaxmpp1.getModulesManager().register(new RosterModule());

    jaxmpp1.getModulesManager().register(new MessageArchivingModule());

    jaxmpp1.getModulesManager().register(new PubSubModule());

    try {

        Thread.sleep(1000);

    } catch (InterruptedException e) {

        // TODO Auto-generated catch block

        e.printStackTrace();

    }



    try 

    {

        tigase.jaxmpp.j2se.Roster.initialize(jaxmpp1);

        tigase.jaxmpp.j2se.Presence.initialize(jaxmpp1);

    }

    catch (JaxmppException e1) 

    {

        // TODO Auto-generated catch block

        e1.printStackTrace();

    }


    jaxmpp1.getProperties().setUserProperty( SessionObject.USER_BARE_JID, BareJID.bareJIDInstance( UserName ) );

    jaxmpp1.getProperties().setUserProperty( SessionObject.PASSWORD, PassWord );


jaxmpp1.getEventBus().addHandler(PresenceModule.ContactChangedPresenceHandler.ContactChangedPresenceEvent.class, presence);

PresenceModule presenceModule = jaxmpp1.getModulesManager().getModule(PresenceModule.class);

jaxmpp1.login(true);

presenceModule.subscribe(JID.jidInstance(subscribeTo));

MessageHandler

MessageModule.MessageReceivedHandler messageHandler = new MessageModule.MessageReceivedHandler()

{

public void onMessageReceived(SessionObject sessionObject,

            Chat chat, Message stanza) 

{

//some code I can t show you

//I'm expecting everything offline to be sent here once going back online

}

}

It could be that I am just missing that messages after first loggin on?

Anyone have a clue about what I'm doing wrong?

Thanks.

Dan.


Replies (3)

Added by Daniel Perrett almost 2 years ago

it certainly seems to be something to do with time after if I wait a period of time before then going back online then I do receive the missed messaged.

Is there an heartbeat tick which I can change?

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

I think that you are experiencing an issue with delayed delivery of messages which failed to be delivered to previous connection as previous stream is still available for resumption. I think that you can do one of two things:

  • force your client to always use the same resource name:
jaxmpp1.getConnectionConfiguration().setResource(resource);
  • try to change stream resumption timeout to lower value on server side (ie. to 0)
c2s/urn\:xmpp\:sm\:3/max-resumption-timeout[I]=0
c2s/urn\:xmpp\:sm\:3/resumption-timeout[I]=0

Added by Daniel Perrett almost 2 years ago

hi,thanks for the comments. Unfortunatley I have no control over the server side.

    (1-3/3)