User Registration
User registration with a Jabber server specifically means the creation (or modification) of a user account for the JSM component—the component that provides the basic IM services and has a notion of users and user sessions. It takes place at the start of a connection to a Jabber server, as does user authentication, as shown in Figure 7-1.
Let’s take a look at the XML fragments involved in
a typical user registration process. Example 7-1
shows the XML stream header exchange and the IQ packets in the
jabber:iq:register
namespace.
First is the XML stream header exchange:
SEND: <?xml version='1.0'?> <stream:stream to='yak' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'> RECV: <?xml version='1.0'?> <stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='3B2DB1A7' xmlns='jabber:client' from='yak'>
Then the client sends a request to discover what information must be passed to the Jabber server to register a new user:
SEND: <iq type='get'> <query xmlns='jabber:iq:register'/> </iq> RECV: <iq type='result'> <query xmlns='jabber:iq:register'> <instructions> Choose a username and password to register with this server. </instructions> <name/> <email/> <username/> <password/> </query> </iq>
The client does as asked and sends the required information, which results in a successful new user registration:
SEND: <iq type='set'> <query xmlns='jabber:iq:register'> <username>leslie</username> ...
Get Programming Jabber now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.