1
votes

I am using Ejabberd's MucSub approach to implement a mobile group chat client. A user Creates a Room and sends MUC Invites to the users that must be the members to this group.The clients are configured to auto-accept the MUC invitations and then subscribe to the room's pubsub node for various events.

However the problem with this is that, a user that in not online will not receive any published event till he's not subscribed to the node and this can not happen until the user comes online once, Hence sending push notifications to such users for these events in not possible.

What should be the approach to achieve this?

1

1 Answers

0
votes

Sending an invitation to a given user is send as a direct message to the user. It is also stored in offline storage, so the user will get it on reconnect.

For example:

  1. UserA sends this MUC invite for [email protected] to userB, userB being offline:

    <message to='[email protected]'>
      <x xmlns='http://jabber.org/protocol/muc#user'>
        <invite to='userB@localhost'/>
      </x>
    </message>
    
  2. When UserB connects, he will receive the invite:

    <message from="[email protected]" type="normal" to="userB@localhost">
     <x xmlns="http://jabber.org/protocol/muc#user">
      <invite from="userA@localhost/laptop">
       <reason/>
      </invite>
     </x>
     <x xmlns="jabber:x:conference" jid="[email protected]"/>
     <body>userA@localhost/laptop invites you to the room [email protected]</body>
     <delay xmlns="urn:xmpp:delay" from="localhost" stamp="2016-11-09T08:10:58.063Z">Offline Storage</delay>
    </message>
    

When userB receives the offline message on connect, he can subscribe to MUC events.