简体   繁体   English

在iOS应用中使用XMPP创建聊天室时出现问题

[英]Problem creating a chat room with XMPP in an iOS app

I have an iphone app where I want to use chat rooms. 我有一个iPhone应用程序,可以在其中使用聊天室。 I've installed an XMPP server (ejabberd) and downloaded the XMPP framework for iOS from google code (http://code.google.com/p/xmppframework/). 我已经安装了XMPP服务器(ejabberd),并从Google代码(http://code.google.com/p/xmppframework/)下载了iOS的XMPP框架。 The server and client work as expected, since I'm able to log in and send chat messages between two users. 服务器和客户端按预期工作,因为我能够登录并在两个用户之间发送聊天消息。

However, when I try to create a chat room using the createOrJoinRoom method of the XMPPRoom class (in XEP-0045), I don't get any reply from the server and the chat room is not created. 但是,当我尝试使用XMPPRoom类(在XEP-0045中)的createOrJoinRoom方法创建聊天室时,没有从服务器收到任何答复,并且未创建聊天室。

I've debugged to see what kind of package is sent to the server and it looks like this: 我进行了调试,以查看将哪种程序包发送到服务器,并且看起来像这样:

<presence from="test2@beta.bogus.net/mynick" to="muumit15@conference.beta.bogus.net">
  <x xmlns="http://jabber.org/protocol/muc"/>
</presence>

I get no error message back but the chat room (muumit15) is not created. 我没有收到任何错误消息,但是未创建聊天室(muumit15)。 At the same time I can use eg Adium client to create a chat room and it succeeds. 同时,我可以使用Adium客户端创建聊天室,并且成功。 The server has been configured so that every user has a right to create chat rooms. 已配置服务器,以便每个用户都有权创建聊天室。

Any ideas? 有任何想法吗? I even tried sniffing the TCP/IP traffic sent by the Adium client but that was encrypted/compressed/binary so I couldn't see what kind of packages it is sending. 我什至尝试嗅探Adium客户端发送的TCP / IP流量,但这是加密/压缩/二进制的,因此我看不到它正在发送哪种包。

See section 7.2.2 of XEP-0045 , particularly Example 18: 请参阅XEP-0045的7.2.2节,尤其是示例18:

<presence
    from='hag66@shakespeare.lit/pda'
    to='coven@chat.shakespeare.lit/thirdwitch'>
  <x xmlns='http://jabber.org/protocol/muc'/>
</presence>

Note that the to address MUST contain a resource, and yours doesn't. 需要注意的是, to解决必须包含一种资源,而你没有。 The resource is the string after the / , which is used as your nickname in the room. 资源是/后面的字符串,用作您在会议室中的昵称。 For more information on the XMPP address format, see RFC 6122 . 有关XMPP地址格式的更多信息,请参见RFC 6122

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM