0

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-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.

Mayoneez
  • 441
  • 5
  • 19

1 Answers1

1

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.

Community
  • 1
  • 1
Joe Hildebrand
  • 10,354
  • 2
  • 38
  • 48
  • Thanks for the clarification but I've also tried those combinations (i.e. having nick on both, none, either one) but that doesn't help. – Mayoneez Jun 22 '11 at 12:42
  • You don't have to put a from address on. The server will do that for you. When it does, the from address will have a resource. The to address MUST have a resource. Try using an existing client to join the room, and watch the protocol it uses. – Joe Hildebrand Jun 23 '11 at 06:11
  • I checked server logs and when Adium made a successful room creation, it sent a message like this: However, when I send the same message, no room is created. What do you mean by "resource", that the To field must have? Resource != nickname? – Mayoneez Jun 28 '11 at 10:02
  • I just reread my original answer, and it didn't make much sense. Rewritten to hopefully be clearer about what the resource is. The XEP-115 (http://xmpp.org/extensions/xep-0115.html) caps information isn't relevant to your success joining the room. – Joe Hildebrand Jun 29 '11 at 07:42