Name

type — Required

Synopsis

Example: <iq type='get'/>

As mentioned already, the from attribute is used to specify the activity.

Attribute Values

type='get'

This is used to specify that the <iq/> element is being used in request mode, to retrieve information. The actual subject of the request is specified using the namespace qualification of the <query/> subelement; see later in this section for details.

Using the HTTP parallel, this is the equivalent of the GET verb.

type='set'

While IQ-get is used to retrieve data, the corresponding set type is used to send data and is the equivalent of the POST verb in the HTTP parallel.

Very often, an IQ-get request will be made of an entity, to discover fields that are to be completed to interact with that entity. The Jabber User Directory (JUD) is a component that plugs into the jabberd backbone and provides simple directory services; users can register an entry in the JUD address book, on which searches can be performed.

Let’s look at how IQ elements are used to interact with the JUD.

The registration conversation with the JUD starts with an IQ-get to discover the fields that can be used for registration, followed by an IQ-set filling those fields in the act of registration. Note how, each time, the JUD responds with an IQ-result to confirm each action’s success.

Here we are requesting registration information from the JUD. Note the namespace that qualifies the <query/> subelement (and hence the <iq/>):

SEND: <iq type='get'

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.