Persistent Groups like Whatsapp

Hi everyone, hope you all are doing well.

So, Whatsapp is built on XMPP right, how can we implement a group feature like Whatsapp? The normal MUCs are not persistent. Please share whatever you know, would be greatly helpful.

Hello,

Persistent group chats is possible but it depends on how you configure it, either creating it via the admin panel or using your XMPP client. As there are many clients I will show you how to do this via the admin interface seen as this is tagged as Openfire, I will assume you own the server and want to allow group chats.

Firstly, you need to bare mind mind who you want to be able to create group chats, do you want to be the one who can only create them? or do you want any user to be able to create them? I will assume you have MUC configured already, go to Group Chat/Group Chat Settings/<service>/Room Creation Permissions. (replace <service> with the service in the menu).

Under it you have two choices under Permission Policy:

  • Allow anyone to create a chat room, anyone with an account on your server will be able to create a MUC.
  • Only specific users/groups can create a chat room, only users or groups specified in the box below will be able to create a MUC.

Pick the one you want.

Next go to Group Chat/Group Chat Settings/<service>/Default Room Settings and check Make Room Persistent, all rooms will now persist by default when created.

Then go to Group Chat/Room Administration/Create New Room to create a new room, now in Whatsapp anyone who joins can speak by default (so the room should be unmoderated), everyone in the group chat can see each others number (in this case will be JID, so the room should allow anyone to see members JIDs), anyone can invite someone else (so the room should allow members to invite others) and anyone can change the name of the group chat (so the room should allow subject change). In order to make this a group chat and not a pubic channel it should not be listed and it should be members-only. So here are the steps:

  • Give the room an ID, this doesn’t really matter and you could just generate a random string… because it will never be publicly joinable
  • Name the room, this is the name of the group chat everyone can see
  • Description, self explanatory.
  • Password Required to enter, enter a password and confirm it if you want extra layer of protection of random people joining.
  • Show Real JID to Occupants, keep this at anyone if you want everyone to know who each other is (aka user@example.com will be public, not .example.com/user)
  • Set allowed to send private message to whatever, you will likely never use it because its a group chat, and you will know the people in and will not private message through the MUC.
  • List Room in Directory, ensure unchecked.
  • Make room moderated, ensure unchecked.
  • Make room members-only, ensure checked.
  • Allow occupants to invite others, ensure checked.
  • Allow occupants to change subject, ensure checked.

That should create a whatsapp-like group chat, you will be added to it as the only user and it should appear in your XMPP client (maybe reload the client to pick it up, otherwise “join” the channel, as you are a member you will be able to join but nobody else). You can then invite all your friends and family to the channel and it should work as expected.

Good luck!

1 Like

Thank you for the explanation. Doubt: The groups did not get destroyed even when the last participant left BEFORE I checked the ‘Make Room Persistent’. What behaviour does it change actually?

The multi-user chat protocol pre-dates the modern user experience of ‘always being connected’. It was designed more like IRC, where you’d be in a chat room only when your device was online. Back in the day, that was not the case continuously.

There is, however, a way around this. MUC occupancy is short-lived: a user is only an occupant when they’re online. MUC affiliation, however, is long-lived. A user can, for example, register to be a member of a chatroom.

You can utilize this to get to the persistency that you’re after. Don’t base it on occupancy, base it on affiliation.

Guus I think what they meant is why, despite the option not being checked, was the group chats already persistent.

@Rushi_Vaghasiya The persistent setting I recommended you change in my previous post was a default value, which is used when you create a group chat via the web admin interface (Maybe used elsewhere, but I am not sure). When you create a group chat from your XMPP client it will define this setting.

It depends on the client, but I believe a lot of clients default to persistent group chats, thus the reason why checking that option did nothing is likely your client already configured the channel to be persistent, checking the value just ensures all channels are implicitly persistent, unless explicitly defined otherwise, which seemed to fit your use case a lot better seen as you didn’t want to deal with persistence issues.

Feel free to uncheck it if you do not want persistent to be the default value.

Hope that clarifies the setting :slight_smile:

(Guus feel free to correct me if I have misunderstood the use of the default value)

1 Like

Yup, that makes it clear.