【问题标题】:How to format xmpp presence stanza to join a MUC room如何格式化 xmpp 存在节以加入 MUC 房间
【发布时间】:2019-06-05 16:27:31
【问题描述】:

我正在尝试弄清楚如何格式化发送到房间的状态节,但我没有遵循我在网上找到的示例。

presence_stanza = f"<presence xmlns='jabber:client' from='{user_id}@conference.domain.com/{what_goes_here} to='{room_id}@conference.domain.com'/>"

特别是我不确定from 地址中/ 后面的ID/字符串是什么。

供参考:

https://www.ejabberd.im/node/5189/index.html

Ejabberd not sending presence stanza to other roster members

【问题讨论】:

    标签: xmpp ejabberd


    【解决方案1】:

    你应该阅读多用户聊天规范,尤其是描述如何进入房间的部分:https://xmpp.org/extensions/xep-0045.html#enter

    规范示例得到了很好的注释。

    您甚至不需要设置 from。服务器将为您设置当前会话的完整 JID。 to 需要是一个完整的 JID,其中确实包括 room_id,还包括房间中用户的昵称。它应该是这样的:

    <presence to='{room_id}@conference.domain.com/{user_nick_in_the_room}'/>
    

    【讨论】:

      猜你喜欢
      • 2015-05-17
      • 2012-10-18
      • 2016-10-25
      • 2017-04-21
      • 2016-04-09
      • 1970-01-01
      • 2015-01-14
      • 2018-10-05
      • 2012-09-13
      相关资源
      最近更新 更多