使用ejabberd创建聊天室StropheJS时出错 [英] Error Creating Chat Room StropheJS with ejabberd

查看:159
本文介绍了使用ejabberd创建聊天室StropheJS时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用StropheJS创建聊天室

I am trying to create a chat room using StropheJS

我的代码:

var presence = $pres({ to:  "testRoom@conference@localhost/yashwanth, from: Strophe.getBareJidFromJid(connection.jid) });
     Groupie.connection.send( presence.tree());
    Groupie.connection.muc.createInstantRoom("testRoom@conference.localhost/yashwanth",
      function(status) {
        console.log("Room Created Successfully", status);
      },
      function(status) {
        console.log("Error Creating Room", status);
      });

在创建房间时,我遇到以下错误.

While creating the room I am facing the below error.

我发现roomJID的格式应为room_name @ conference @ HOST @/nickname.因此,按照格式,我发送了.但这并没有创造房间.

I found that the roomJID should be in the format of room_name@conference@HOST@/nickname . So as per the format i send that. But it doesn't create the room.

Error Creating Room <iq xmlns=​"jabber:​client" from=​
"conference@conference.localhost" to=​"yashwanth@inst1.eab.com/​
5441440311438943022710601" type=​"error" id=​"1:​sendIQ">​<query xmlns=​"http:​/​/​
jabber.org/​protocol/​muc#owner">​…​</query>​<error code=​"404" type=​"cancel">​
<item-not-found xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-stanzas">​</item-not-
found>​<text xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-stanzas">​Conference room 
does not exist​</text>​</error>​</iq>

我正在使用ejabberd作为我的XMPP服务器.如果创建了会议室,那么将在哪个数据库中保存与会议室相关的详细信息?是保存在muc_registered表中还是muc_room表中?

And I am using ejabberd as my XMPP server. If the room creates then in which database able the details related to the room will be saved? Either it save in muc_registered table or muc_room table?

推荐答案

要在XMPP中加入会议室,无需先创建它.

To join a room in XMPP, you do not need to create it first.

您的代码在做什么:

  1. 它将存在发送到房间,表示您正在加入.如果不存在,则会创建它.
  2. 您尝试创建会议室,由于会议室始终存在,因此应始终失败.
  3. 您正在询问房间的存储位置.除非它是持久性的,否则不会存储它,如果您没有配置ejabberd来将默认房间选项设置为持久性,那么在您的示例中就不会这样.否则,您需要按照 XEP-0045多用户聊天使之持久.永久房间存储在Mnesia表muc_room中.
  4. StropheJS MUC插件中的
  5. createInstantRoom创建具有默认选项的空间,就像加入一样,所以我不明白为什么在这里需要它.
  1. It sends the presence to the room, meaning that you are joining it. If it does not exist it will be created.
  2. You try creating the room, which should always fails as the room always exists.
  3. You are asking where room is stored. It is not stored unless it is persistent, which is not the case in your example if you did not configure ejabberd to set default room options to persistent. Otherwise you need to edit room options as defined in XEP-0045 Multi User Chat to make it persistent. Persistent rooms are stored in Mnesia table muc_room.
  4. createInstantRoom in StropheJS MUC plugin create room with default options, just like joining so I do not see why it would be needed here.

因此,我无法告诉您您打算用代码实现什么,但是只要将状态信息发送到聊天室就足以创建一个非持久性聊天室并将其加入.无需致电createInstantRoom.

So, I cannot tell what you are trying to achieve with your code, but just send the presence to the room is enough to create a non-persistent chat room and join it. No need to call createInstantRoom.

这篇关于使用ejabberd创建聊天室StropheJS时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆