0 Replies Latest reply on Aug 9, 2017 2:59 PM by Luis Ángel

    SmackConfiguration.setPacketReplyTimeout

    Luis Ángel

      Hi there,

      int packetReplyTimeout = 15000;     // 15 seconds.

      I've been trying to use this SmackConfiguration.setPacketReplyTimeout(packetReplyTimeout); I've been trying to use this in a chat app, but I cannot get it to work.

      I have this use case:

       

      User A is sending messages to User B, at this point, both users are online, and everything is working as expected, the problem comes when for some reason, User B gets disconnected, let's say he lost connection, so there's no time to tell the server that I went offline. So then when User A sends a new message to User B, there's no response back within the packetReplyTimeout value (15 seconds).

      After some time, I get the next stanza:

       

      <message from='UserA@email.com/resourceId' to='UserB@email.com/resourceId' type='error' xml:lang='en' id='123-abc'>

          <archived by='email.com' xmlns='urn:xmpp:mam:tmp' id='id-123' />

          <stanza-id by='email.com' xmlns='urn:xmpp:sid:0' id='id-123' />

          <body>message</body>

          <markable xmlns='urn:xmpp:chat-markers:0' />

          <request xmlns='urn:xmpp:receipts' />

          <error type='cancel'>

              <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' />

              <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>User session terminated</text>

          </error>

      </message>

       

      So I look for the <archived extension, and if it is there, then I mark the message as sent, the problem is that sometimes that stanza is coming after 20 seconds, or sometimes after 5 minutes, so I would like to get the SmackConfiguration.setPacketReplyTimeout(packetReplyTimeout); working, so I can notify this before that long period of time.

      And finally my question would be: is there anything that I need to do to get the SmackConfiguration.setPacketReplyTimeout(packetReplyTimeout); to work?

       

      I am using 4.2.0 library version.