Tuesday, April 5, 2011

Uniquness of an id attribute on an XMPP iq stanza.

The stanza in XMPP has an 'id' attribute. An id is used so that the sender of multiple requests can determine which result they're getting when they start coming back. The XMPP Protocol states about the id attribute the following:

It is OPTIONAL for the value of the 'id' attribute to be unique globally, within a domain, or within a stream. The semantics of IQ stanzas impose additional restrictions; see IQ Semantics (IQ Semantics).

The "additional restrictions" as discussed in IQ Semantics is really the following:

1.) An request stanza MUST provide an id.
2.) An response stanza MUST provide the id of the request stanza it's responding to.

So, in conclusion, there doesn't seem to be a hard and fast rule. It's entirely legit (although probably a bad idea) to just an empty string as your id. Looking at my console, I noticed that Pidgin used the word "purple" (since Pidgin uses the "libpurple" library) plus what appeared to be an incrementing hexadecimal number...


No comments:

Post a Comment