3

I'm trying to implement chat for my webapp with following features:

  • When user logs in he should see a number of unread messages (which is both offline messages and "unseen", I will explain "unseen" in next step).
  • When user is anywhere in the app but on chat window he should be notified that he has a new message. Message should be marked "unseen" and must be added to the count of unread messages.

The first point is quite easily achieved using XEP-0013: Flexible Offline Message Retrieval. So I can retrieve offline messages and when I'm sure user has seen them - I remove them from unread list. But the problem is: how do I achieve same thing for "unseen" messages?

In short what I need is: any message should be marked as offline, unless user sees it and it's removed from the list by explicit request.

Can I achieve that with XMPP and how do I do that?

Thanks in advance.

4410
  • 73
  • 2
  • 7

1 Answers1

4

What you are trying to do is to basically store a counter of unseen stuff in your account. I think you do not need flexible offline retrieval as when you connect the messages would simply become unseen. You thus only have to deal with one case: Unseen.

I will reply from the perspective of ejabberd, that I know better as one of the developer: I would use private storage to store your current state of unseen count and conversation.

Mickaël Rémond
  • 9,035
  • 1
  • 24
  • 44
  • Ok, so it seems like there's not XEP for my case, right? So I have to implement it myself. The problem is that I'm not familiar with erlang, so it seems like I should write a plugin for Openfire or some nodejs XMPP server, because I'm mostly Java and Javascript dev. – 4410 May 26 '15 at 12:12
  • 2
    Yes, there is no XEP defining that need, so indeed it has to be custom. – Mickaël Rémond May 28 '15 at 07:17