xmppejabberdejabberd-moduleejabberd-apiejabberd-hooks

Message lost when recipient disconnect suddenly in Ejabberd


Message lost when recipient disconnect from INTERNET suddenly due to some network problem. In this case I want to stop message lose.

Example: User A and B are online and chatting. A send messages to B. Then suddenly User B lost INTERNET connection, in meantime User A is still sending messages to B. Server assume B is still on-line because don't know there is net problem at B.

I am using Ejabberd 16.08 . Please suggest the way how can I resolve this issue.


Solution

  • Assuming a standard c2s connection, I would suggest using Stream Management, which is supported by ejabberd, but also requires client support. This won't prevent "lost" messages, but it will allow for faster detection and notification when user B doesn't disconnect cleanly.

    Another alternative is to use XMPP over BOSH, which has a number of client libraries available depending on your exact platform. BOSH acts very similarly to Stream Management, and the same caveats apply.

    There will always be cases, due to the nature of internet communications, where the server believes a message to be sent, but the client has not received it. In such cases, it can help to use Message Archive Management to synchronize user B's client when it reconnects.