By default XMPP is as reliable as your network is. Unfortunately in some cases that is not very reliable - in some network conditions disconnects can be frequent and message loss can occur.
To overcome this, XMPP has an optional extension (XEP-0198: Stream Management) which, when supported by both the client and server, can allow a client to resume a disconnected session, and prevent message loss.
When using XEP-0198 both the client and the server keep a queue of the most recently sent stanzas - this is cleared when the other end acknowledges they have received the stanzas. If the client disconnects, instead of marking the user offline the server pretends the client is still online for a short (configurable) period of time. If the client reconnects within this period, any stanzas in the queue that the client did not receive are re-sent.
If the client fails to reconnect before the timeout then it is marked offline as normal, and any stanzas in the queue are returned to the sender as a “recipient-unavailable” error.
This module also provides some events used by mod_cloud_notify. These events are: “smacks-ack-delayed”, “smacks-hibernation-start” and “smacks-hibernation-end”. See mod_cloud_notify for details on how this events are used there.
Use prosody 0.10+ to have per user limits on allowed sessions in hibernation state and allowed sessions for which the h-value is kept even after the hibernation timed out. These are settable using
||300 (5 minutes)||The number of seconds a disconnected session should stay alive for (to allow reconnect)|
||false||Enable Stream Management on server connections? Experimental|
||0||How many stanzas to send before requesting acknowledgement|
||60 (1 minute)||The number of seconds an ack must be unanswered to trigger an “smacks-ack-delayed” event|
||10||The number of allowed sessions in hibernated state (limited per user)|
||10||The number of allowed sessions with timed out hibernation for which the h-value is still kept (limited per user)|
|0.9||Works, no per user limit of hibernated sessions|
|0.8||Works, no per user limit of hibernated sessions, use version 7693724881b3|
Clients that support XEP-0198: