开发者

Problem creating a chat room with XMPP in an iOS app

I have an iphone app where I want to use chat rooms. I've installed an XMPP server (ejabberd) and downloaded the XMPP framework for iOS from google code (http://code.google.com/p/xmppframework/). 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开发者_JAVA技巧-0045), I don't get any reply from the server and the chat room is not created.

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. At the same time I can use e.g. Adium client to create a chat room and it succeeds. 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.


See section 7.2.2 of XEP-0045, particularly Example 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. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜