Name

to — Optional

Synopsis

<iq to='jdev@conference.jabber.org'/>

This attribute is used to specify the intended recipient of the info/query action or response. If no to attribute is specified, the delivery of the packet is set to the sender, as is the case for <message/> packets. However, unlike the case for <message/> packets, <iq/> packets are usually dealt with en route and handled by the JSM.

What does that mean? Packets sent from a client travel over a jabber:client XML stream and reach the Jabber server, where they’re routed to the JSM.[13]

A large part of the JSM consists of a series of packet handlers, in the form of modules, whose job it is to review packets as they pass through and act upon them as appropriate; some of these actions may cause a packet to be deemed to have been “delivered” to its intended destination (thus causing the packet routing to end for that packet) before it gets there.

So in the case of <iq/> packets without a to attribute, the default destination is the sender’s JID, as we’ve already seen with the <message/> element. But because JSM handlers that receive a packet may perform some action to handle it and cause that packet’s delivery to be terminated (marked complete) prematurely, the effect is that something sensible will happen to the <iq/> packet that doesn’t have a to attribute and it won’t appear to act like a boomerang. Here’s an example:

The namespace jabber:iq:browse represents a powerful browsing mechanism that pervades much of the ...

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.