[ejabberd] Handling Groups

Holger Weiß holger at zedat.fu-berlin.de
Mon Oct 21 12:54:44 MSK 2019


* Jai Rangi <jprangi at gmail.com> [2019-10-20 14:10]:
> Working on a mobile chat application using xmpp-framwork. Having a little
> issue with group, using mod_muc for that.

The MUC extension was created before mobile was a thing, so some things
will feel a bit weirdo.  But you should be able build modern group chat
functionality using MUC.  See, for example, how the Android client
Conversations¹ implements it.  (There's a replacement called MIX in the
works, which tries to address these issues.  ejabberd has initial
support, but the spec isn't finalized so it's not quite production-ready
yet.)

¹ https://github.com/siacs/Conversations

> Issues I am running into is?
> - Have to send presence before we send the message.

One wouldn't design things this way today, but this as such shouldn't be
a problem for you?

> - History size is default 20 messages. If the user is offline and if there
> are more than 20 messages, user miss the messages older than 20.
> - Every time user send presence, server send last 20 messages, even if the
> user already has received those messages.

See https://xmpp.org/extensions/xep-0045.html#enter-managehistory for
how to tell the server to not send any history (maxstanzas='0'), and
rely on MAM.

> Messages dont get stored in MySql Table

For MUC, MAM is enabled on a per-room basis.  To have it enabled by
default for newly created rooms, use this setting from the example
configuration:

https://github.com/processone/ejabberd/blob/19.09/ejabberd.yml.example#L175-L176

>     default_room_options: {allow_subscription: true, mam: true,
> members_only: true, persistent: false}

Your syntax looks wrong.

The tricky part on iOS will be push notifications for MUC messages, as
the room will only send messages to participants that are currently
present in the room.  The possible solutions depend on (whether and) how
you implement push notifications in general.

Holger


More information about the ejabberd mailing list