Resuming a stream in Smack 4.1

Hi,

I’ve been working on an IM Client for android which was using aSmack back then but have already managed to update it to Smack 4.1 release version.

I have managed to enable Stream Management by using:

XMPPTCPConnection.setUseStreamManagementDefault(true);

Now, SM seems to work fine when ‘cleanly’ disconnecting from the connection by manually triggering:

XMPPTCPConnection.disconnect();

since the messages sent on the disconnected client were retrieved whenever it goes connected again.

Now, I would just like to ask on how will the handling be when the client got ‘unclean’ disconnection from the WiFi / GSM? (i.e Turning off/on the WiFi)

Any thoughts would be appreciated,

Thanks!

Now, SM seems to work fine when ‘cleanly’ disconnecting from the connection by manually triggering:

  1. XMPPTCPConnection.disconnect();

since the messages sent on the disconnected client were retrieved whenever it goes connected again.

No, if you call disconnect(), Smack will drop the state rendering stream resumption impossible. But Smack resends the unacknowledged stanzas when reconnected even without stream management resumption.

Now, I would just like to ask on how will the handling be when the client got ‘unclean’ disconnection from the WiFi / GSM? (i.e Turning off/on the WiFi)

Smack retains the stream state after “unclean” disconnects or instantShutdown(), which makes it possible to resume the stream.