ejabberd MUC-SUB事件通知直到MUC邀请被接受

时间:2016-11-09 06:38:00

标签: xmpp ejabberd publish-subscribe multiuserchat

我正在使用Ejabberd的MucSub方法来实现移动群聊客户端。用户创建会议室并将MUC邀请发送给必须是该组成员的用户。客户端配置为自动接受MUC邀请,然后订阅会议室的pubsub节点以进行各种活动。

然而,问题在于,非在线的用户在他未订阅节点之前不会收到任何已发布的事件,直到用户访问时才会发生这种情况在线一次,因此无法为这些用户发送推送通知。

实现这一目标的方法应该是什么?

1 个答案:

答案 0 :(得分:0)

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 room@conference.localhost to userB, userB being offline:

    <message to='room@conference.localhost'>
      <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="room@conference.localhost" 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="room@conference.localhost"/>
     <body>userA@localhost/laptop invites you to the room room@conference.localhost</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.