【问题标题】:Unexpected presence stanza for MUC create roomMUC 创建房间的意外存在节
【发布时间】:2015-01-14 04:01:12
【问题描述】:

6E64864A-36AF-4B83-8EF5-6E58C4A6117A当我尝试连续两次创建同一个房间时,我两次都从包含“201”状态代码的服务中接收到存在节。

这是预期的行为吗?从 XEP-0045 开始,似乎 201 应该仅在第一次创建房间时发送。

请帮助我理解这一点。为什么两次都发送状态码 201?

我如何区分创建新房间和加入现有房间?

请看下面的顺序:

---------第一个请求从这里开始

SEND: <presence to="erik_yo@conference.localhost/GJ">
<x xmlns="http://jabber.org/protocol/muc"/>
<x xmlns="vcard-temp:x:update"><photo/></x></presence>


RECV: <presence xmlns="jabber:client" from="erik_yo@conference.localhost/GJ" to="erik@localhost/imac">
<x xmlns="vcard-temp:x:update"><photo/></x>
<x xmlns="http://jabber.org/protocol/muc#user">
<item jid="erik@localhost/imac" affiliation="owner" role="moderator"/>
<status code="110"/><status code="201"/></x></presence>
// configure the room persistent here
//<field type="boolean" var="muc#roomconfig_persistentroom" value="1"/>
SEND: <iq type="set" to="erik_yo@conference.localhost" id="6E64864A-36AF-4B83-8EF5-6E58C4A6117A">
<query xmlns="http://jabber.org/protocol/muc#owner"><x .........

RECV: <iq xmlns="jabber:client" from="yo@conference.localhost" 
to="erik@localhost/imac" id="6E64864A-36AF-4B83-8EF5-6E58C4A6117A" type="result">
<query xmlns="http://jabber.org/protocol/muc#owner"/></iq>

---------第二个请求从这里开始

SEND: <presence to="erik_yo@conference.localhost/GJ" type="unavailable">
<x xmlns="vcard-temp:x:update"><photo/></x></presence>

SEND: <presence to="erik_yo@conference.localhost/GJ">
<x xmlns="http://jabber.org/protocol/muc"/>
<x xmlns="vcard-temp:x:update"><photo/></x></presence>

RECV: <presence xmlns="jabber:client" from="erik_yo@conference.localhost/GJ" to="erik@localhost/imac" type="unavailable">
<x xmlns="vcard-temp:x:update"><photo/></x><x xmlns="http://jabber.org/protocol/muc#user"><item affiliation="owner" role="none"/>
<status code="110"/></x></presence>

RECV: <presence xmlns="jabber:client" from="erik_yo@conference.localhost/GJ" to="erik@localhost/imac">
<x xmlns="vcard-temp:x:update"><photo/></x>
<x xmlns="http://jabber.org/protocol/muc#user">
<item jid="erik@localhost/imac" affiliation="owner" role="moderator"/><status code="110"/><status code="201"/></x></presence>

---------------------第一次请求后发送的配置节

 SEND: <iq type="set" to="erik_yo@conference.localhost" id="C72C4629-B318-4733-884B-B6A8BEAFB50F">
<query xmlns="http://jabber.org/protocol/muc#owner"> 
<x xmlns="jabber:x:data" type="submit"><field type="hidden" var="FORM_TYPE"><value>http://jabber.org/protocol/muc#roomconfig</value> <field type="boolean" var="muc#roomconfig_enable_logging" value="1"/> 
<field type="text-single" var="muc#roomconfig_roomname" value="IdeaFactory"/> <field type="boolean" var="muc#roomconfig_membersonly" value="1"/> 
<field type="boolean" var="muc#roomconfig_moderatedroom" value="0"/> 
<field type="boolean" var="muc#roomconfig_persistentroom" value="1"/> <field type="boolean" var="muc#roomconfig_publicroom" value="0"/> <field type="text-single" var="muc#roomconfig_maxusers" value="10"/> <field type="jid-multi" var="muc#roomconfig_roomowners" value="erik@localhost"/> <field type="boolean" var="muc#roomconfig_changesubject" value="1"/></field></x> </query></iq>

【问题讨论】:

  • 哪个软件提供了MUC组件?
  • 来自proceesone的ejabberd mod_muc

标签: xmpp ejabberd xmppframework multiuserchat


【解决方案1】:

进入房间并获得 201 状态代码后,您应该接受默认配置或明确配置房间(请参阅section 10.1 of XEP-0045)。如果您在执行上述任一操作之前发送不可用状态,服务器将破坏房间。因此,在您的示例中,房间实际上是“新创建的”两次

另外,对于某些服务器,房间的默认设置是“临时”,即当最后一个参与者离开时房间被销毁。您可能希望将其配置为“永久房间”,以便它一直存在。

【讨论】:

  • 看起来我必须 default_room_options : persistent:true 到 ejabberd 配置....然后我没有得到第二个请求的 201。我将研究为什么来自客户端的配置不起作用...接受澄清答案
  • didReceivePresence - 我在配置房间后收到状态码 303 作为回报。你能帮我解决这个问题吗@legoscia
  • @GaganJoshi 您可以在此处找到数字状态代码列表:xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
  • @legoscia 感谢您的帮助。你能告诉我吗。如果我邀请用户。比受邀用户还必须配置房间与否。配置后解锁房间是什么概念。提前致谢
  • 您可以在 XEP-0045 的第 10.1 节中找到对此的描述:xmpp.org/extensions/xep-0045.html#createroom
猜你喜欢
  • 2011-08-26
  • 1970-01-01
  • 2015-04-09
  • 1970-01-01
  • 2011-10-10
  • 2015-05-17
  • 2018-10-05
  • 2012-08-01
相关资源
最近更新 更多