We are announcing today MUC Subscription, a new experimental feature in ejabberd that make group conversations in XMPP work seamlessly with mobile clients.
Toward persistent group chat participation
Today, a large proportion of XMPP chat projects are targeting both mobile, focusing on Whatsapp-like group conversations. Developers of such projects had been deeply frustrated because it was not possible to easily implement this feature on top of XMPP group chat features.
Looking for expert support and management for your ejabberd deployment?
Contact ProcessOne today »
The main issue with XMPP group chat is that it is bound to user presence. Group chat in XMPP is based on XEP-0045: Multi-User Chat. It was designed to replicate IRC-like chat room, at a time where mobile internet connections were very rare. As a result, the protocol is based on presence. You join a room when you want to participate. You leave it when you are done.
On mobile, presence is almost irrelevant. You are always somewhat loosely reachable. However, your application may not run all the time because, to save battery life, mobile operating systems will hibernate your application when you are not actively using it. Mobile applications are supposed to be reachable through push notification services as they have generally no open TCP connection to the server in background state.
From XMPP point of view, it means that when the application is asleep, the XMPP client is not online. When it is not online, the user cannot be a participant in any chat room. He does not get messages nor notifications and thus misses events in the chat room.
Moreover, every time the user gets online, he has to rejoin all his ongoing conversations (MUC rooms). This is very consuming in terms of battery life and bandwidth.
Several workarounds had been tried by developers:
- Use long running session (XEP-0198: Stream management, or custom approach)
- Re-implement a conversation protocol on top of PubSub.
However, none of this approach did prove to be an easy straightforward solution to the problem. It did not work very well in the sense that these work-around are not totally transparent and affect several parts of your client development.
MIX to the rescue
There is a work-in-progress at the XMPP Standard Foundation (XSF) that aims to build a full rework of the Multi-User Chat specification, taking the requirement to avoid relying on presence into account.
The specification is called XEP-0369: Mediated Information eXchange (MIX). ejabberd already implements the draft since a few months and we are actively working on it and supported the effort.
However, this is a work-in-progress that will take time before being fully usable as a Multi-User Chat replacement.
As we wanted to solve the problem today, for all XMPP developers, we decided to explore a path in-between. We developed a smaller, less ambitious extension, that solves the issues developers are facing to implement mobile group chat today. We are still committed to MIX implementation and we think our proposed extension will please mobile developers and help us channel feedback to the XSF to build future proof MIX specification.
Introducing MUC Sub
So, what is MUC Sub about and how is it designed ?
The goal of MUC Sub is to try to rely as much as possible on existing MUC specification, while making the smallest possible change that make mobile group conversation client easy.
We found that we only missed a few components. To play well with mobile, we just need to add the ability to send and receive messages to a room without having to send presence to the room. More generally we have to allow other type of interactions with the room (like configuration changes for example or kick and ban) without having to send presence to it to become a participant.
Basically, you need to be able to have a permanent subscription to a given room to receive the events. That subscription should grant you the right to send message and interact with the room. The name of our extension come from that simple idea: Add subscription feature to Multi-User Chat, hence MUC Sub.
We found we can put all the pieces together by reusing existing XMPP protocol components:
- Reuse XMPP PubSub protocol to manage the subscription and wrap the events received as a subscriber from the room.
- Rely on Message Archive Management to let client resync history as they need.
- Rely on existing Push components (ProcessOne extension or XEP-0357: Push Notifications) to send events to mobile devices when application is asleep.
After writing a draft specification and a working implementation, we are very happy with the result: We have a working MUC Sub implementation that enables mobile group conversations. And we did all this by leveraging existing MUC specification and staying compliant with it.
The draft protocol is published on ejabberd documentation site: MUC Sub Draft
ejabberd main repository contains the code for MUC Sub. You can find it on Github: ejabberd.
The feature is enabled by default. To use it, just make sure you set the new parameter “Allow subscription” in the room on which you want to use it.
We suggest, you can read the draft document we wrote, use the implementation and develop a mobile client.
Please, while you do so, send us your feedback about your success and troubles implementing your mobile group conversations.
MUC Sub is already available in ejabberd Community Edition repository and is going to be available as an experimental feature in ejabberd 16.07.
It will also be deployed as an experimental feature for ejabberd SaaS platform during the Summer. We are planning to test it as soon as possible with existing customers that are already willing to use it in production.
We hope you will like the approach and develop great new mobile clients thanks to ejabberd and MUC Sub !