I\'m developing an android app contains \"Messaging\" using OpenFire as an XMPP server and using Smack for android client. All functions works fine, but when a user is onlin
This is a bug with keepalive mechanism. Please check this:
https://issues.igniterealtime.org/browse/OF-963
I am having same issue with version 4.2.3. Switched back to 4.0.2. Issue is reported for version 4.0.3.
This behavior is likely introduced by an XMPP feature called Stream Management.
In short, this feature allows for clients that briefly disconnect to pick up where they left off, without doing all of the things associated with a normal connect (which tends to involve a lot of resources).
This is useful for clients with spotty network connectivity, or devices that kill connections when putting an application to the background, like on mobile phones.
Openfire implements this functionality. Note that packets are not 'lost', as you describe. Instead, all of the unhandled packets will be buffered, and, when the client is 'to late' to reconnect (a timeout applies, I think the default is 3 minutes), those packets will be treated as if they were sent to a disconnected device.
If you want, you can disable this feature by setting the 'stream.management.active' property to 'false' (but for typical setups, you don't want this, as the Stream Management functionality serves a good purpose).