1
votes

I have used ejabberd open source server to implement my chatting application. It has been successful in delivering and receiving messages, but sometimes delivery acknowledgements and read acknowledgements are getting lost.

If the connection close session stanza is send by the client to ejabberd server, then further messages are for sure stored in spool table. Consider a scenario that there was problem in client network, and client got disconnected without sending close session stanza to server. Server assumes client is still online and doesn't store messages into spool table.

But when client comes online, all the pending messages are delivered to client (spool plus that some messages when server thought client is online).

Where does ejabberd stores offline messages instead of spool table?

1

1 Answers

3
votes

If you do not close the session properly, then depending on your server Kernel TCP/IP configuration, server may take a will to detect the connection has been lost. In that case ejabberd is not notified the TCP connection is not valid and send messages on that TCP connection. Server buffer them in the TCP stack. From ejabberd point of view, those messages have been send, thus they do not need to be stored in offline storage. ejabberd stores messages in offline storage when there is no session open for a given user, but in that case, there is an open session.

To add a higher level of reliability for messages with ejabberd community version, you need to implement acknowledgement and possibly pings. You can look into implementing XEP-0198: Stream Management and possibly enable XMPP Ping from server to detect connection loss.