[jdev] Question on XMPP URIs?

Ralph Meijer jabber.org at ralphm.ik.nu
Fri Dec 15 06:08:48 CST 2006


On Fri, 2006-12-15 at 16:38 +0530, Ishan De Silva wrote:
> Hi,
> 
> Generally a URI is of the form "scheme://authority/path". For example 
> http://www.example.com/index.html
> 
> A JID is of the form node at domain/resource. If we have a JID 
> guest at example.com/Home, according to RFC 4622, the XMPP URI take the 
> form xmpp://guest@example.com/Home.

Complementing Cecil, you misread the RFC. Typical XMPP URIs don't have
an authority component, so your example should look like:

    xmpp:guest at example.com/Home

This is because the authority component describes the service to connect
to, to get to a certain resource. In the XMPP case, you usually use your
own server to connect to other JIDs, so the authority component can be
empty (the default being your own server, with your own account).

If you wanted to have a specific service to connect to before accessing
the resource, you'd do:

    xmpp://test@example.org/guest@example.com/Home

This means: open an XMPP connection to the server at example.org using
account 'test', and then use that connection to access the JID
guest at example.com/Home. This is explained in section 2.3.

In this example, the path component is:

    guest at example.com

Not that XMPP URIs don't have path segments like other (hierarchical)
URI schemes, most notably HTTP. The fact that we have a '/' character in
there is an historical artefact carried over from JIDs.


> Is there a way that we can map an XMPP URI to the general URI format 
> where we don't have the "node@" component? I mean can we have 
> xmpp://example.com/node/Home?

No. An XMPP URI /is/ a real URI, no mapping required.

> Which part of an XMPP URI is analogous to the "path" of a generic URI? 
> Is it both "node" and "resource" or "resource" only?

Neither, as I explained above.

-- 
Groetjes,

ralphm




More information about the JDev mailing list