Joining a room
Let's take the example of Biff Tannen (biff@tannen.hello
) and his gang hanging out at Lou's café, which we'll refer to as gang@lous.cafe
.
Notice that a chat room address looks just like a JID! The MUC room itself will sit on a domain handled by an XMPP server and the local
part becomes the identifier of the room itself, in this case, gang
. This means that an MUC room is just a JID that you can talk to.
Now, joining a non-password-protected room is simple: no, wait! It's really simple. In essence, all we do is send a directed Presence (remember that from Chapter 2, Diving into the Core XMPP Concepts?) to the room we want to join with a chosen nickname (more on that later) and, provided it is not taken, we're in!
Let's say Marty turns up at the diner and wants to step into the conversation to help out George McFly:
<presence from='marty@mcfly.fam/diner' id='join1' to='gang@lous.cafe/calvin' />
Note
Technically, we should also include a child element that signifies...