Name

to — Optional

Synopsis

<message to='qmacro@jabber.org'>

The to attribute is used to specify the intended recipient of the message and is a JID. The recipient may be another Jabber user, in which case the JID will usually be in the form username @ hostname (with an optional /resource if a message should be sent to a specific client connection), or it could be a Jabber server identity, in which case the JID will be in the form hostname> with an optional /resource depending on the situation.

If no to attribute is specified, then the message will be directed back to the sender, or the server, depending on the circumstances. This may or may not be what you want.

This is also the case with the to attribute for the <iq/> element; however, it is not the case with the <presence/> element.[5]See Element Handling by the Jabber Server for an explanation.

[5] Actually, it is, internally, but the effect is that it isn’t. The packet is swallowed on its final delivery stage by the presence handler.

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.