xmppmongoose-im

Unread messages count on XMPP


I am using MongooseIM to develop a XMPP-based Chat App and I'm trying to implement the number of unread messages in my app.

I'm using XEP-0022 (Message Events) to track when a message is received from the server, received from the client, seen from the other client and XEP-0430 (Inbox) to keep track of unread messages that are read as soon as I retrieve them from MAM.

My main issue here is that, when requesting messages from Inbox, it returns all of the messages and not only the text ones. To clarify: it returns also messages that are sent to ack that a message is received and all of the in-between messages, thus incrementing the unread counter and making it very unrealistic.

What can I do to solve this issue?


Solution

  • You can use XEP-0333: Chat Markers instead of XEP-0022 (marked as obsolete) to pass delivery/read status around. MongooseIM Inbox is aware of XEP-0333 markers and will not count them towards the total number of unread messages. This is the easiest option if you have control over the XMPP extensions in use.