【问题标题】:Ejabberd MucSub: When a member sends a presence unavailable, the service does not respondEjabberd MucSub:当成员发送出席信息不可用时,服务不响应
【发布时间】:2020-04-10 06:21:50
【问题描述】:

我正在使用 Ejabberd 19.09 和 mucsub 进行持久的群组对话。

当组的成员发送不可用状态时,有时服务器根本没有响应。 如果我们在存在不可用之前发送一个可用的存在之后重复相同的测试,则服务器会响应。 无论如何,显然,我们的房间入住率没有变化。

这是预期的行为吗?

第一次测试:

重现第一个测试的步骤:

  1. admin test1 创建房间 roomX(仅限会员)
    <!-- [CREATE ROOM] | test1 -->
    <iq from='test1@x.com' to='roomX@conference.x.com' type='set' id='1111111'>
      <subscribe xmlns='urn:xmpp:mucsub:0' nick='test1'>
        <event node='urn:xmpp:mucsub:nodes:messages' /><event node='urn:xmpp:mucsub:nodes:affiliations' /><event node='urn:xmpp:mucsub:nodes:subject' /><event node='urn:xmpp:mucsub:nodes:config' /><event node='urn:xmpp:mucsub:nodes:subscribers' /><event node='urn:xmpp:mucsub:nodes:presence' />
      </subscribe>
    </iq>
  1. admin test1 邀请并订阅用户test2
<!-- [INVITE test2] | test1 -->
<message from='test1@x.com' id='33333' to='roomX@conference.x.com'>
  <x xmlns='http://jabber.org/protocol/muc#user'>
    <invite to='test2@x.com'><reason>REASON</reason></invite>
  </x>
</message>
<!-- [SUBSCRIBE test2 TO ROOM] | test1 -->
<iq from='test1@x.com' to='roomX@conference.x.com' type='set' id='222222'>
  <subscribe xmlns='urn:xmpp:mucsub:0' jid='test2@x.com' nick='test2'>
    <event node='urn:xmpp:mucsub:nodes:messages' /><event node='urn:xmpp:mucsub:nodes:presence' /><event node='urn:xmpp:mucsub:nodes:subject' /><event node='urn:xmpp:mucsub:nodes:config' /><event node='urn:xmpp:mucsub:nodes:subscribers' /><event node='urn:xmpp:mucsub:nodes:presence' />
  </subscribe>
</iq>
  1. 邀请被自动接受,用户test2现在是房间成员,他可以发送消息并订阅所有活动
  2. 成员test2想放弃房间,并发送出席信息类型=不可用
<!-- [test2 leaves the room] | test2 -->
<presence to='roomX@conference.x.com/test2' from='test2@x.com' type='unavailable'>
  <status>leave</status>
</presence>

结果:

  • 服务不响应会员
  • 房间入住率没有变化:会员的隶属关系仍然 “会员”,角色仍然是“会员”,订阅仍然有效

第二次测试:

重现第二次测试的步骤:

  1. admin test1 创建房间 roomX(仅限会员)
  2. admin test1 邀请并订阅用户test2
  3. 邀请被自动接受,用户test2现在是房间成员,他可以发送消息并订阅所有活动
  4. 成员test2 发送出席信息 type=available(理论上这是多余的,但它是作为测试的一部分故意制作的)
<!-- [test2 JOINS THE ROOM] | test2 -->
<presence from='test2@x.com' id='n13mt3l' to='room@conference.x.com/test2'>
  <x xmlns='http://jabber.org/protocol/muc'/>
</presence>
  1. 成员test2想要放弃房间,并发送出席信息类型=不可用

结果

  • 服务响应成员
  • 房间入住率没有变化:会员的隶属关系仍然 “会员”,角色仍然是“会员”,订阅仍然有效

【问题讨论】:

    标签: xmpp ejabberd multiuserchat


    【解决方案1】:

    第一次测试:步骤: 管理员邀请会员成员

    我猜使用https://xmpp.org/extensions/xep-0045.html#invite-mediated

    发送一个不可用的状态

    为什么?它应该是信息,而不是存在:

    被邀请者可以选择正式拒绝(而不是忽略) 邀请;这是发件人可能想要的东西 获悉。为了拒绝邀请,受邀者必须 向自身发送以下形式的消息

    【讨论】:

    • 本次测试的目的不是拒绝邀请(效果很好),而是加入一段时间后退出群。
    【解决方案2】:

    我认为你错过了第一步:

    <presence to='test2-157@conference.x.com/test1'  id='s6MLD-390'><x xmlns='http://jabber.org/protocol/muc'></x></presence>
    

    【讨论】:

    • 在“第一次测试”中我不发送出席信息,但在 mucsub 中加入是自动的。在“第二次测试”中,我发送了您所指示的内容,检查以以下开头的代码块:
    猜你喜欢
    • 1970-01-01
    • 2013-03-13
    • 1970-01-01
    • 1970-01-01
    • 2014-12-20
    • 2022-06-29
    • 2020-12-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多