Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delivering messages to offline users in a multi-user chat (ejabberd)

Actually we are using ejabberd server for one of our client's Chat application. Everything is working well except for Group chat.

We are using MUC for Group chat but it is not sending Messages to the member whenever uses is offline. Is there any alternative plugin or something where we can make that working?

Or any one can suggest about how to receive offline messages for that user from Group chat history.

Thanks in advance

like image 207
user2609447 Avatar asked Mar 12 '14 13:03

user2609447


1 Answers

That's because there's no such concept for multi-user chat rooms. In fact, if you'll think about this a bit more you'll understand why:

  • Potentially unbound number of participants might be present in a room at any given time.

    So exactly for which users not currently present in the MUC room should the server store the messages in the offline storage? I mean, in the generic case, the server does not know all the users who could ever possibly chat in a given room it hosts.

    (Well, if this would be the only problem, it could possibly work for members-only rooms, I must admit.)

  • MUC rooms are not "local server only": a potentially unbound number of users from any number of other servers might join the room, and messages to those users will be delivered by routing them via their respective servers.

    Obviously, this is another reason why such an idea of "MUC room offline storage" has no sense.

  • MUC rooms are by definition transient: when a user is offline, they're not in any room— (re-)joninig a room is an explicit action.

    This is in fact the most important reason for not supporting offline storage.

As you can see, XMPP MUC rooms are much like IRC chats on steroids.

So what you really want is "room history"—a part of the XMPP-0045 extension which allows the client to explicitly ask the room for the message history they missed. In a sense, instead of storing offline message for each user, the room might be configured to store just a certain number of the most recent messages sent to it (or all such messages for a given period of time). Then the room supports querying these messages by the joined users.

There's another possibility which you might explore: "multicast addressing" of XEP-0033 ("Extended stanza addressing"). Basically it allows a client to use a special multicast service to send their message to multiple recipients at once. The upside is that offline storage is there again. The downside is that I doubt such a multicast service is supported out of the box in ejabberd, and it seems like that extension leaves much details about how it could be implemented unspecified.

like image 164
kostix Avatar answered Sep 21 '22 14:09

kostix