Joining XMPP MUC Room without invite - ejabberd

孤人 提交于 2019-12-12 01:47:47

问题


For persistent XMPP rooms, what is the way to make a client join back the room again if he / she has disconnected once? During testing, I find that simply sending back the presence stanza to the said room's JID does not make the client be available in the room again. Does re-entering a room happen only when a user has received an invite (and thus, in our case, if the user disconnects once, the user would need another invite to join the room?)?

If that is the case, then what is the best way to implement the auto-generation of such invites for original room participants who are reconnecting?

Thanks.


回答1:


Best way it's to use pubsub feature and relative MultiUserChat bookmarks. You can develop a custom bookmarks manager if you need something declined on your special needs.

Do you need the following steps:

1) When create a persistent groupchat, bookmark the groupchat after first join. (=> save on db groupchat name and password)

2) When recive an invite, bookmark the groupchat after the first join (=> save on db groupchat name and password)

3) On login / reconnect retrive bookmarks list

4) Foreach bookmark -> join (and assign listeners and so on)

5) Provide a delete bookmark condition (based on timestamp, session, explicit request and so on).

Official specifications




回答2:


There is a proposed XEP and it's implemented in latest ejabberd which supports subscriptions. It expose MUC rooms as pubsub nodes to introduce the concept of MUC rooms subscribers.



来源:https://stackoverflow.com/questions/39045381/joining-xmpp-muc-room-without-invite-ejabberd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!