Messaging
We’ve been using the term “message” in quite a general sense, to represent
data passing from one Jabber entity to another. In fact, as we’ll see in
Chapter 5, there are different sorts of
messages—and each one
has a certain role within the whole context of the Jabber protocol. They are sometimes referred to as elements, and there are three
of them:
<message/>,
<iq/>, and
<presence/>.
Note
Actually, there are four, but the
fourth, <route/>,
is only used in the server to route messages between the various
components. More details on
<route/> can be found
in Section 4.1.2.3 in Chapter 4.
The <message/> element has five
types—normal, chat,
groupchat, headline, and
error.
The <iq/> and
<presence/> elements also have types
to distinguish and describe their usage and context.
The <iq/> element has the types
get, set,
result, and error, while
the <presence/> element has, among
others, the types
available and unavailable.
Details can be seen in Table 2-1.
Furthermore, we already know that
these elements can be extended using namespaces. Each element and type,
and each of the pre-defined namespaces (those that begin
jabber:) have been designed with specific scenarios
in mind.
An example of a headline
<message/> element
containing an extension qualified by a predefined namespace is shown in
Example 2-3.
|
Element |
Tag |
Types |
|
Message |
|
normal, chat, groupchat, headline, error |
|
IQ |
|
get, set, result, error |
|
Presence |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access