When the XMPP protocol for instant messaging was first created one and a half decades ago the protocol could rightly assume stable Internet connectivity on the client side. Few if any people at the time thought about mobile networks and users moving around, loosing network coverage every now and then or suddenly changing IP addresses. As a result, XMPP in its original flavor doesn't deal with such scenarios very gracefully and drops messages that are in flight during such events. Fortunately, XMPP did not stand still and there's a fix for this.
The fix is called "stream management" and has been specified in XMPP extension XEP-198. What stream management basically does is message buffering on the server side and requiring an acknowledgement of the client before the message is discarded. In practice, the stream management implementation on my Prosody server at home can easily correct for client side "coverage holes" of well beyond 5 minutes. Works like a charm. Out of the box, stream management is deactivated in Prosody, but it can easily be switched on by downloading and copying "mod_smacks" to Prosody's module directory and then activating it in the config file. The Prosody website has all the necessary details here. A must have feature for mobile clients, no doubt.