Rules and Regulations

A JID must contain a hostname part to be valid. The username and resource parts are optional; circumstance and usage dictates when either of these parts is necessary. A username is specific to the hostname that it’s paired up with. For example: qmacro@jabber.org is not the same as qmacro@jabber.com.

There are some restrictions on how each JID part is composed; Table 5-1 details these restrictions. Although you can be particular about the case of letters in a username, any operations (such as comparisons) at the Jabber server are case-insensitive. For example, if a user has registered dj as his username, then another user cannot register with the username DJ. However, the person who registered as dj can connect and send DJ when he authenticates, and for the duration of that session will be known as DJ not dj.

On the other hand, resources are case-sensitive.

Table 5-1. JID restrictions

JID part

Restrictions

username

A username can be up to 255 characters in length and may not contain any ASCII character under 33 (decimal),[2] nor can it contain any of the characters :, @, /, ", or '; also, whitespace (tabs, newlines, and carriage returns) and control characters are forbidden.

hostname

The same restrictions apply here as for normal DNS hostnames.

resource

There are no restrictions for the resource part of a JID.

[2] That is, it may not contain spaces or those considered to be control characters.

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.