RFC 6121 - Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence
Internet Engineering Task Force (IETF) P. Saint-Andre
Request for Comments: 6121 Cisco
Obsoletes:
3921
March 2011
Category: Standards Track
ISSN: 2070-1721
Extensible Messaging and Presence Protocol (XMPP):
Instant Messaging and Presence
Abstract
This document defines extensions to core features of the Extensible
Messaging and Presence Protocol (XMPP) that provide basic instant
messaging (IM) and presence functionality in conformance with the
requirements in
RFC 2779
. This document obsoletes
RFC 3921
Status of this Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in
Section 2 of RFC 5741
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
Copyright Notice
Copyright (c) 2011 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to
BCP 78
and the IETF Trust's Legal
Provisions Relating to IETF Documents
) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Saint-Andre Standards Track [Page 1]
RFC 6121
XMPP IM March 2011
Table of Contents
. Introduction . . . . . . . . . . . . . . . . . . . . . . . .
1.1
. Overview . . . . . . . . . . . . . . . . . . . . . . . .
1.2
. History . . . . . . . . . . . . . . . . . . . . . . . . .
1.3
. Requirements . . . . . . . . . . . . . . . . . . . . . .
1.4
. Functional Summary . . . . . . . . . . . . . . . . . . .
1.5
. Terminology . . . . . . . . . . . . . . . . . . . . . . .
. Managing the Roster . . . . . . . . . . . . . . . . . . . . .
2.1
. Syntax and Semantics . . . . . . . . . . . . . . . . . .
2.1.1
. Ver Attribute . . . . . . . . . . . . . . . . . . . .
10
2.1.2
. Roster Items . . . . . . . . . . . . . . . . . . . .
10
2.1.2.1
. Approved Attribute . . . . . . . . . . . . . . .
10
2.1.2.2
. Ask Attribute . . . . . . . . . . . . . . . . . .
10
2.1.2.3
. JID Attribute . . . . . . . . . . . . . . . . . .
11
2.1.2.4
. Name Attribute . . . . . . . . . . . . . . . . .
11
2.1.2.5
. Subscription Attribute . . . . . . . . . . . . .
11
2.1.2.6
. Group Element . . . . . . . . . . . . . . . . . .
12
2.1.3
. Roster Get . . . . . . . . . . . . . . . . . . . . .
12
2.1.4
. Roster Result . . . . . . . . . . . . . . . . . . . .
13
2.1.5
. Roster Set . . . . . . . . . . . . . . . . . . . . .
14
2.1.6
. Roster Push . . . . . . . . . . . . . . . . . . . . .
14
2.2
. Retrieving the Roster on Login . . . . . . . . . . . . .
16
2.3
. Adding a Roster Item . . . . . . . . . . . . . . . . . .
17
2.3.1
. Request . . . . . . . . . . . . . . . . . . . . . . .
17
2.3.2
. Success Case . . . . . . . . . . . . . . . . . . . .
17
2.3.3
. Error Cases . . . . . . . . . . . . . . . . . . . . .
18
2.4
. Updating a Roster Item . . . . . . . . . . . . . . . . .
22
2.4.1
. Request . . . . . . . . . . . . . . . . . . . . . . .
22
2.4.2
. Success Case . . . . . . . . . . . . . . . . . . . .
24
2.4.3
. Error Cases . . . . . . . . . . . . . . . . . . . . .
24
2.5
. Deleting a Roster Item . . . . . . . . . . . . . . . . .
24
2.5.1
. Request . . . . . . . . . . . . . . . . . . . . . . .
24
2.5.2
. Success Case . . . . . . . . . . . . . . . . . . . .
25
2.5.3
. Error Cases . . . . . . . . . . . . . . . . . . . . .
26
2.6
. Roster Versioning . . . . . . . . . . . . . . . . . . . .
26
2.6.1
. Stream Feature . . . . . . . . . . . . . . . . . . .
26
2.6.2
. Request . . . . . . . . . . . . . . . . . . . . . . .
26
2.6.3
. Success Case . . . . . . . . . . . . . . . . . . . .
27
. Managing Presence Subscriptions . . . . . . . . . . . . . . .
30
3.1
. Requesting a Subscription . . . . . . . . . . . . . . . .
30
3.1.1. Client Generation of Outbound Subscription Request . 31
3.1.2. Server Processing of Outbound Subscription Request . 32
3.1.3
. Server Processing of Inbound Subscription Request . .
34
3.1.4
. Client Processing of Inbound Subscription Request . .
35
3.1.5. Server Processing of Outbound Subscription Approval . 36
3.1.6. Server Processing of Inbound Subscription Approval . 38
Saint-Andre Standards Track [Page 2]
RFC 6121
XMPP IM March 2011
3.2
. Canceling a Subscription . . . . . . . . . . . . . . . .
40
3.2.1
. Client Generation of Subscription Cancellation . . .
40
3.2.2. Server Processing of Outbound Subscription
Cancellation . . . . . . . . . . . . . . . . . . . .
40
3.2.3. Server Processing of Inbound Subscription
Cancellation . . . . . . . . . . . . . . . . . . . .
41
3.3
. Unsubscribing . . . . . . . . . . . . . . . . . . . . . .
43
3.3.1
. Client Generation of Unsubscribe . . . . . . . . . .
43
3.3.2
. Server Processing of Outbound Unsubscribe . . . . . .
43
3.3.3
. Server Processing of Inbound Unsubscribe . . . . . .
44
3.4
. Pre-Approving a Subscription Request . . . . . . . . . .
46
3.4.1
. Client Generation of Subscription Pre-Approval . . .
46
3.4.2
. Server Processing of Subscription Pre-Approval . . .
47
. Exchanging Presence Information . . . . . . . . . . . . . . .
48
4.1
. Presence Fundamentals . . . . . . . . . . . . . . . . . .
48
4.2
. Initial Presence . . . . . . . . . . . . . . . . . . . .
49
4.2.1
. Client Generation of Initial Presence . . . . . . . .
49
4.2.2
. Server Processing of Outbound Initial Presence . . .
50
4.2.3
. Server Processing of Inbound Initial Presence . . . .
50
4.2.4
. Client Processing of Initial Presence . . . . . . . .
51
4.3
. Presence Probes . . . . . . . . . . . . . . . . . . . . .
51
4.3.1
. Server Generation of Outbound Presence Probe . . . .
52
4.3.2
. Server Processing of Inbound Presence Probe . . . . .
53
4.3.2.1
. Handling of the 'id' Attribute . . . . . . . . .
55
4.4
. Subsequent Presence Broadcast . . . . . . . . . . . . . .
57
4.4.1. Client Generation of Subsequent Presence Broadcast . 57
4.4.2
. Server Processing of Subsequent Outbound Presence . .
57
4.4.3
. Server Processing of Subsequent Inbound Presence . .
58
4.4.4
. Client Processing of Subsequent Presence . . . . . .
59
4.5
. Unavailable Presence . . . . . . . . . . . . . . . . . .
59
4.5.1
. Client Generation of Unavailable Presence . . . . . .
59
4.5.2. Server Processing of Outbound Unavailable Presence . 59
4.5.3
. Server Processing of Inbound Unavailable Presence . .
61
4.5.4
. Client Processing of Unavailable Presence . . . . . .
62
4.6
. Directed Presence . . . . . . . . . . . . . . . . . . . .
62
4.6.1
. General Considerations . . . . . . . . . . . . . . .
62
4.6.2
. Client Generation of Directed Presence . . . . . . .
63
4.6.3
. Server Processing of Outbound Directed Presence . . .
63
4.6.4
. Server Processing of Inbound Directed Presence . . .
64
4.6.5
. Client Processing of Inbound Directed Presence . . .
64
4.6.6
. Server Processing of Presence Probes . . . . . . . .
64
4.7
. Presence Syntax . . . . . . . . . . . . . . . . . . . . .
65
4.7.1
. Type Attribute . . . . . . . . . . . . . . . . . . .
65
4.7.2
. Child Elements . . . . . . . . . . . . . . . . . . .
66
4.7.2.1
. Show Element . . . . . . . . . . . . . . . . . .
66
4.7.2.2
. Status Element . . . . . . . . . . . . . . . . .
67
4.7.2.3
. Priority Element . . . . . . . . . . . . . . . .
68
4.7.3
. Extended Content . . . . . . . . . . . . . . . . . .
69
Saint-Andre Standards Track [Page 3]
RFC 6121
XMPP IM March 2011
. Exchanging Messages . . . . . . . . . . . . . . . . . . . . .
69
5.1
. One-to-One Chat Sessions . . . . . . . . . . . . . . . .
69
5.2
. Message Syntax . . . . . . . . . . . . . . . . . . . . .
70
5.2.1
. To Attribute . . . . . . . . . . . . . . . . . . . .
70
5.2.2
. Type Attribute . . . . . . . . . . . . . . . . . . .
71
5.2.3
. Body Element . . . . . . . . . . . . . . . . . . . .
73
5.2.4
. Subject Element . . . . . . . . . . . . . . . . . . .
74
5.2.5
. Thread Element . . . . . . . . . . . . . . . . . . .
75
5.3
. Extended Content . . . . . . . . . . . . . . . . . . . .
77
. Exchanging IQ Stanzas . . . . . . . . . . . . . . . . . . . .
77
. A Sample Session . . . . . . . . . . . . . . . . . . . . . .
78
. Server Rules for Processing XML Stanzas . . . . . . . . . . .
84
8.1
. General Considerations . . . . . . . . . . . . . . . . .
85
8.2
. No 'to' Address . . . . . . . . . . . . . . . . . . . . .
85
8.3
. Remote Domain . . . . . . . . . . . . . . . . . . . . . .
85
8.4
. Local Domain . . . . . . . . . . . . . . . . . . . . . .
86
8.5
. Local User . . . . . . . . . . . . . . . . . . . . . . .
86
8.5.1
. No Such User . . . . . . . . . . . . . . . . . . . .
86
8.5.2
. localpart@domainpart . . . . . . . . . . . . . . . .
86
8.5.2.1
. Available or Connected Resources . . . . . . . .
87
8.5.2.2
. No Available or Connected Resources . . . . . . .
89
8.5.3
. localpart@domainpart/resourcepart . . . . . . . . . .
90
8.5.3.1
. Resource Matches . . . . . . . . . . . . . . . .
90
8.5.3.2
. No Resource Matches . . . . . . . . . . . . . . .
90
8.5.4
. Summary of Message Delivery Rules . . . . . . . . . .
92
. Handling of URIs . . . . . . . . . . . . . . . . . . . . . .
93
10
. Internationalization Considerations . . . . . . . . . . . . .
94
11
. Security Considerations . . . . . . . . . . . . . . . . . . .
94
12
. Conformance Requirements . . . . . . . . . . . . . . . . . .
95
13
. References . . . . . . . . . . . . . . . . . . . . . . . . .
99
13.1
. Normative References . . . . . . . . . . . . . . . . . .
99
13.2
. Informative References . . . . . . . . . . . . . . . . .
99
Appendix A
. Subscription States . . . . . . . . . . . . . . . .
103
A.1
. Defined States . . . . . . . . . . . . . . . . . . . . .
103
A.2. Server Processing of Outbound Presence Subscription
Stanzas . . . . . . . . . . . . . . . . . . . . . . . . .
104
A.2.1
. Subscribe . . . . . . . . . . . . . . . . . . . . . .
105
A.2.2
. Unsubscribe . . . . . . . . . . . . . . . . . . . . .
105
A.2.3
. Subscribed . . . . . . . . . . . . . . . . . . . . .
106
A.2.4
. Unsubscribed . . . . . . . . . . . . . . . . . . . .
106
A.3. Server Processing of Inbound Presence Subscription
Stanzas . . . . . . . . . . . . . . . . . . . . . . . . .
106
A.3.1
. Subscribe . . . . . . . . . . . . . . . . . . . . . .
107
A.3.2
. Unsubscribe . . . . . . . . . . . . . . . . . . . . .
107
A.3.3
. Subscribed . . . . . . . . . . . . . . . . . . . . .
108
A.3.4
. Unsubscribed . . . . . . . . . . . . . . . . . . . .
109
Appendix B
. Blocking Communication . . . . . . . . . . . . . . .
110
Appendix C
. vCards . . . . . . . . . . . . . . . . . . . . . . .
110
Saint-Andre Standards Track [Page 4]
RFC 6121
XMPP IM March 2011
Appendix D
. XML Schema for jabber:iq:roster . . . . . . . . . .
110
Appendix E
. Differences From
RFC 3921
. . . . . . . . . . . . .
112
Appendix F
. Acknowledgements . . . . . . . . . . . . . . . . . .
113
. Introduction
1.1
. Overview
The Extensible Messaging and Presence Protocol (XMPP) is an
application profile of the Extensible Markup Language [
XML
] that
enables the near-real-time exchange of structured yet extensible data
between any two or more network entities. The core features of XMPP
defined in [
XMPP-CORE
] provide the building blocks for many types of
near-real-time applications, which can be layered on top of the core
by sending application-specific data qualified by particular XML
namespaces (refer to [
XML-NAMES
]). This document defines XMPP
extensions that provide the basic functionality expected of an
instant messaging (IM) and presence application as described in
IMP-REQS
].
1.2
. History
The basic syntax and semantics of XMPP were developed originally
within the Jabber open-source community, mainly in 1999. In late
2002, the XMPP Working Group was chartered with developing an
adaptation of the core Jabber protocol that would be suitable as an
IETF IM and presence technology in accordance with [
IMP-REQS
]. In
October 2004, [
RFC3920
] and [
RFC3921
] were published, representing
the most complete definition of XMPP at that time.
Since 2004 the Internet community has gained extensive implementation
and deployment experience with XMPP, including formal
interoperability testing carried out under the auspices of the XMPP
Standards Foundation (XSF). This document incorporates comprehensive
feedback from software developers and service providers, including a
number of backward-compatible modifications summarized under
Appendix E
. As a result, this document reflects the rough consensus
of the Internet community regarding the IM and presence features of
XMPP 1.0, thus obsoleting
RFC 3921
1.3
. Requirements
Traditionally, IM applications have combined the following factors:
1. The central point of focus is a list of one's contacts or
"buddies" (in XMPP this list is called a "roster").
Saint-Andre Standards Track [Page 5]
RFC 6121
XMPP IM March 2011
2. The purpose of using such an application is to exchange
relatively brief text messages with particular contacts in close
to real time -- often relatively large numbers of such messages
in rapid succession, in the form of a one-to-one "chat session"
as described under
Section 5.1
3. The catalyst for exchanging messages is "presence" -- i.e.,
information about the network availability of particular contacts
(thus knowing who is online and available for a one-to-one chat
session).
4. Presence information is provided only to contacts that one has
authorized by means of an explicit agreement called a "presence
subscription".
Thus at a high level this document assumes that a user needs to be
able to complete the following use cases:
o Manage items in one's contact list
o Exchange messages with one's contacts
o Exchange presence information with one's contacts
o Manage presence subscriptions to and from one's contacts
Detailed definitions of these functionality areas are contained in
RFC 2779
IMP-REQS
], and the interested reader is referred to that
document regarding in-depth requirements. Although the XMPP IM and
presence extensions specified herein meet the requirements of
RFC
2779
, they were not designed explicitly with that specification in
mind, since the base protocol evolved through an open development
process within the Jabber open-source community before
RFC 2779
was
written. Although XMPP protocol extensions addressing many other
functionality areas have been defined in the XMPP Standards
Foundation's XEP series (e.g., multi-user text chat as specified in
XEP-0045
]), such extensions are not specified in this document
because they are not mandated by
RFC 2779
Implementation Note:
RFC 2779
stipulates that presence services
must be separable from IM services and vice-versa; i.e., it must
be possible to use the protocol to provide a presence service, a
messaging service, or both. Although the text of this document
assumes that implementations and deployments will want to offer a
unified IM and presence service, it is not mandatory for an XMPP
service to offer both a presence service and a messaging service,
and the protocol makes it possible to offer separate and distinct
Saint-Andre Standards Track [Page 6]
RFC 6121
XMPP IM March 2011
services for presence and for messaging. (For example, a
presence-only service could return a
error if a client attempts to send a
1.4
. Functional Summary
This non-normative section provides a developer-friendly, functional
summary of XMPP-based IM and presence features; consult the sections
that follow for a normative definition of these features.
XMPP-CORE
] specifies how an XMPP client connects to an XMPP server.
In particular, it specifies the preconditions that need to be
fulfilled before a client is allowed to send XML stanzas (the basic
unit of meaning in XMPP) to other entities on an XMPP network. These
preconditions comprise negotiation of the XML stream and include
exchange of XML stream headers, optional channel encryption via
Transport Layer Security [
TLS
], mandatory authentication via Simple
Authentication and Security Layer [
SASL
], and binding of a resource
to the stream for client addressing. The reader is referred to
XMPP-CORE
] for details regarding these preconditions, and knowledge
of [
XMPP-CORE
] is assumed herein.
Interoperability Note: [
RFC3921
] specified one additional
precondition: formal establishment of an instant messaging and
presence session. Implementation and deployment experience has
shown that this additional step is unnecessary. However, for
backward compatibility an implementation MAY still offer that
feature. This enables older software to connect while letting
newer software save a round trip.
Upon fulfillment of the preconditions specified in [
XMPP-CORE
], an
XMPP client has a long-lived XML stream with an XMPP server, which
enables the user controlling that client to send and receive a
potentially unlimited number of XML stanzas over the stream. Such a
stream can be used to exchange messages, share presence information,
and engage in structured request-response interactions in close to
real time. After negotiation of the XML stream, the typical flow for
an instant messaging and presence session is as follows:
1. Retrieve one's roster. (See
Section 2.2
.)
2. Send initial presence to the server for broadcast to all
subscribed contacts, thus "going online" from the perspective of
XMPP communication. (See
Section 4.2
.)
Saint-Andre Standards Track [Page 7]
RFC 6121
XMPP IM March 2011
3. Exchange messages, manage presence subscriptions, perform roster
updates, and in general process and generate other XML stanzas
with particular semantics throughout the life of the session.
(See Sections
, and
.)
4. Terminate the session when desired by sending unavailable
presence and closing the underlying XML stream. (See
Section 4.5
.)
1.5
. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
RFC
2119
KEYWORDS
].
This document inherits the terminology defined in [
XMPP-CORE
].
The terms "automated client" and "interactive client" are to be
understood in the sense defined in [
TLS-CERTS
].
For convenience, this document employs the term "user" to refer to
the owner of an XMPP account; however, account owners need not be
humans and can be bots, devices, or other automated applications.
Several other terms, such as "interested resource", are defined
within the body of this document.
Following the "XML Notation" used in [
IRI
] to represent characters
that cannot be rendered in ASCII-only documents, some examples in
this document use the form "...." as a notational device to
represent [
UNICODE
] characters (e.g., the string "ř" stands
for the Unicode character LATIN SMALL LETTER R WITH CARON); this form
is definitely not to be sent over the wire in XMPP systems.
In examples, lines have been wrapped for improved readability,
"[...]" means elision, and the following prepended strings are used
(these prepended strings are not to be sent over the wire):
o C: = client
o CC: = contact's client
o CS: = contact's server
o S: = server
o UC: = user's client
Saint-Andre Standards Track [Page 8]
RFC 6121
XMPP IM March 2011
o US: = user's server
Readers need to be aware that the examples are not exhaustive and
that, in examples for some protocol flows, the alternate steps shown
would not necessarily be triggered by the exact data sent in the
previous step; in all cases, the protocol definitions specified in
this document or in normatively referenced documents rule over any
examples provided here. All examples are fictional and the
information exchanged (e.g., usernames and passwords) does not
represent any existing users or servers.
. Managing the Roster
In XMPP, a user's roster contains any number of specific contacts. A
user's roster is stored by the user's server on the user's behalf so
that the user can access roster information from any device. When
the user adds items to the roster or modifies existing items, if an
error does not occur then the server SHOULD store that data
unmodified if at all possible and MUST return the data it has stored
when an authorized client requests the roster.
Security Warning: Because the user's roster can contain
confidential data, the server MUST restrict access to this data so
that only authorized entities (typically limited to the account
owner) are able to retrieve, modify, or delete it.
RFC 3921
assumed that the only place where a user stores their roster
is the server where the user's account is registered and at which the
user authenticates for access to the XMPP network. This
specification removes that strict coupling of roster storage to
account registration and network authentication, with the result that
a user could store their roster at another location, or could have
multiple rosters that are stored in multiple locations. However, in
the absence of implementation and deployment experience with a more
flexible roster storage model, this specification retains the
terminology of
RFC 3921
by using the terms "client" and "server" (and
"the roster" instead of "a roster"), rather than coining a new term
for "a place where a user stores a roster". Future documents might
provide normative rules for non-server roster storage or for the
management of multiple rosters, but such rules are out of scope for
this document.
2.1
. Syntax and Semantics
Rosters are managed using
XMPP-CORE
]), specifically by means of a
qualified by the 'jabber:iq:roster' namespace. The detailed syntax
and semantics are defined in the following sections.
Saint-Andre Standards Track [Page 9]
RFC 6121
XMPP IM March 2011
2.1.1
. Ver Attribute
The 'ver' attribute is a string that identifies a particular version
of the roster information. The value MUST be generated only by the
server and MUST be treated by the client as opaque. The server can
use any appropriate method for generating the version ID, such as a
hash of the roster data or a strictly increasing sequence number.
Inclusion of the 'ver' attribute is RECOMMENDED.
Use of the 'ver' attribute is described more fully under
Section 2.6
Interoperability Note: The 'ver' attribute of the
was not defined in
RFC 3921
and is newly defined in this
specification.
2.1.2
. Roster Items
The
Section 2.1.5
) contains one
Section 2.1.4
) typically contains
multiple
"roster item" (sometimes also called a "contact").
The syntax of the
sections.
2.1.2.1
. Approved Attribute
The boolean 'approved' attribute with a value of "true" is used to
signal subscription pre-approval as described under
Section 3.4
(the
default is "false", in accordance with [
XML-DATATYPES
]).
A server SHOULD include the 'approved' attribute to inform the client
of subscription pre-approvals. A client MUST NOT include the
'approved' attribute in the roster sets it sends to the server, but
instead MUST use presence stanzas of type "subscribed" and
"unsubscribed" to manage pre-approvals as described under
Section 3.4
Interoperability Note: The 'approved' attribute of the
element was not defined in
RFC 3921
and is newly defined in this
specification.
2.1.2.2
. Ask Attribute
The 'ask' attribute of the
"subscribe" is used to signal various subscription sub-states that
include a "Pending Out" aspect as described under
Section 3.1.2
Saint-Andre Standards Track [Page 10]
RFC 6121
XMPP IM March 2011
A server SHOULD include the 'ask' attribute to inform the client of
"Pending Out" sub-states. A client MUST NOT include the 'ask'
attribute in the roster sets it sends to the server, but instead MUST
use presence stanzas of type "subscribe" and "unsubscribe" to manage
such sub-states as described under
Section 3.1.2
2.1.2.3
. JID Attribute
The 'jid' attribute of the
Identifier (JID) that uniquely identifies the roster item.
The 'jid' attribute is REQUIRED whenever a client or server adds,
updates, deletes, or returns a roster item.
2.1.2.4
. Name Attribute
The 'name' attribute of the
be associated with the JID, as determined by the user (not the
contact). Although the value of the 'name' attribute MAY have
meaning to a human user, it is opaque to the server. However, the
'name' attribute MAY be used by the server for matching purposes
within the context of various XMPP extensions (one possible
comparison method is that described for XMPP resourceparts in
XMPP-ADDR
]).
It is OPTIONAL for a client to include the 'name' attribute when
adding or updating a roster item.
2.1.2.5
. Subscription Attribute
The state of the presence subscription is captured in the
'subscription' attribute of the
subscription-related values are:
none: the user does not have a subscription to the contact's
presence, and the contact does not have a subscription to the
user's presence; this is the default value, so if the subscription
attribute is not included then the state is to be understood as
"none"
to: the user has a subscription to the contact's presence, but the
contact does not have a subscription to the user's presence
from: the contact has a subscription to the user's presence, but the
user does not have a subscription to the contact's presence
both: the user and the contact have subscriptions to each other's
presence (also called a "mutual subscription")
Saint-Andre Standards Track [Page 11]
RFC 6121
XMPP IM March 2011
In a roster result (
Section 2.1.4
), the client MUST ignore values of
the 'subscription' attribute other than "none", "to", "from", or
"both".
In a roster push (
Section 2.1.6
), the client MUST ignore values of
the 'subscription' attribute other than "none", "to", "from", "both",
or "remove".
In a roster set (
Section 2.1.5
), the 'subscription' attribute MAY be
included with a value of "remove", which indicates that the item is
to be removed from the roster; in a roster set the server MUST ignore
all values of the 'subscription' attribute other than "remove".
Inclusion of the 'subscription' attribute is OPTIONAL.
2.1.2.6
. Group Element
The
which the roster item is to be grouped by a client. An
element MAY contain more than one
roster groups are not exclusive. Although the XML character data of
the
to the server. However, the
server for matching purposes within the context of various XMPP
extensions (one possible comparison method is that described for XMPP
resourceparts in [
XMPP-ADDR
]).
It is OPTIONAL for a client to include the
adding or updating a roster item. If a roster set (
Section 2.1.5
includes no
being affiliated with no group.
2.1.3
. Roster Get
A "roster get" is a client's request for the server to return the
roster; syntactically it is an IQ stanza of type "get" sent from
client to server and containing a
'jabber:iq:roster' namespace, where the
contain any
C:
type='get'>
The expected outcome of sending a roster get is for the server to
return a roster result.
Saint-Andre Standards Track [Page 12]
RFC 6121
XMPP IM March 2011
2.1.4
. Roster Result
A "roster result" is the server's response to a roster get;
syntactically it is an IQ stanza of type "result" sent from server to
client and containing a
roster' namespace.
The
for each contact and therefore can contain more than one
element.
S:
type='result'>
If the roster exists but there are no contacts in the roster, then
the server MUST return an IQ-result containing a child
element that in turn contains no
MUST NOT return an empty
S:
type='result'>
If the roster does not exist, then the server MUST return a stanza
error with a condition of
S:
type='error'>
Saint-Andre Standards Track [Page 13]
RFC 6121
XMPP IM March 2011
2.1.5
. Roster Set
A "roster set" is a client's request for the server to modify (i.e.,
create, update, or delete) a roster item; syntactically it is an IQ
stanza of type "set" sent from client to server and containing a
The following rules apply to roster sets:
1. The
element.
2. The server MUST ignore any value of the 'subscription' attribute
other than "remove" (see
Section 2.1.2.5
).
Security Warning: Traditionally, the IQ stanza of the roster set
included no 'to' address, with the result that all roster sets
were sent from an authenticated resource (full JID) of the account
whose roster was being updated. Furthermore,
RFC 3921
required a
server to perform special-case checking of roster sets to ignore
the 'to' address; however, this specification has removed that
special-casing, which means that a roster set might include a 'to'
address other than that of the sender. Therefore, the entity that
processes a roster set MUST verify that the sender of the roster
set is authorized to update the roster, and if not return a
C:
type='set'>
2.1.6
. Roster Push
A "roster push" is a newly created, updated, or deleted roster item
that is sent from the server to the client; syntactically it is an IQ
stanza of type "set" sent from server to client and containing a
The following rules apply to roster pushes:
1. The
one
Saint-Andre Standards Track [Page 14]
RFC 6121
XMPP IM March 2011
2. A receiving client MUST ignore the stanza unless it has no 'from'
attribute (i.e., implicitly from the bare JID of the user's
account) or it has a 'from' attribute whose value matches the
user's bare JID
S:
type='set'>
As mandated by the semantics of the IQ stanza as defined in
XMPP-CORE
], each resource that receives a roster push from the
server is supposed to reply with an IQ stanza of type "result" or
"error" (however, it is known that many existing clients do not reply
to roster pushes).
C:
type='result'/>
C:
type='result'/>
Security Warning: Traditionally, a roster push included no 'from'
address, with the result that all roster pushes were sent
implicitly from the bare JID of the account itself. However, this
specification allows entities other than the user's server to
maintain roster information, which means that a roster push might
include a 'from' address other than the bare JID of the user's
account. Therefore, the client MUST check the 'from' address to
verify that the sender of the roster push is authorized to update
the roster. If the client receives a roster push from an
unauthorized entity, it MUST NOT process the pushed data; in
addition, the client can either return a stanza error of
latter behavior overrides a MUST-level requirement from
XMPP-CORE
] for the purpose of preventing a presence leak).
Implementation Note: There is no error case for client processing
of roster pushes; if the server receives an IQ of type "error" in
response to a roster push then it SHOULD ignore the error.
Saint-Andre Standards Track [Page 15]
RFC 6121
XMPP IM March 2011
2.2
. Retrieving the Roster on Login
Upon authenticating with a server and binding a resource (thus
becoming a connected resource as defined in [
XMPP-CORE
]), a client
SHOULD request the roster before sending initial presence (however,
because receiving the roster is not necessarily desirable for all
resources, e.g., a connection with limited bandwidth, the client's
request for the roster is not mandatory). After a connected resource
sends initial presence (see
Section 4.2
), it is referred to as an
"available resource". If a connected resource or available resource
requests the roster, it is referred to as an "interested resource".
The server MUST send roster pushes to all interested resources.
Implementation Note: Presence subscription requests are sent to
available resources, whereas the roster pushes associated with
subscription state changes are sent to interested resources.
Therefore, if a resource wishes to receive both subscription
requests and roster pushes, it MUST both send initial presence and
request the roster.
A client requests the roster by sending a roster get over its stream
with the server.
C:
type='get'>
S:
type='result'>
subscription='both'>
subscription='from'/>
subscription='both'/>
Saint-Andre Standards Track [Page 16]
RFC 6121
XMPP IM March 2011
If the server cannot process the roster get, it MUST return an
appropriate stanza error as described in [
XMPP-CORE
] (such as
or returning the roster).
2.3
. Adding a Roster Item
2.3.1
. Request
At any time, a client can add an item to the roster. This is done by
sending a roster set containing a new item.
C:
type='set'>
2.3.2
. Success Case
If the server can successfully process the roster set for the new
item (i.e., if no error occurs), it MUST create the item in the
user's roster and proceed as follows.
The server MUST return an IQ stanza of type "result" to the connected
resource that sent the roster set.
S:
type='result'/>
The server MUST also send a roster push containing the new roster
item to all of the user's interested resources, including the
resource that generated the roster set.
Saint-Andre Standards Track [Page 17]
RFC 6121
XMPP IM March 2011
S:
type='set'>
subscription='none'>
S:
type='set'>
subscription='none'>
As mandated by the semantics of the IQ stanza as defined in
XMPP-CORE
], each resource that receives a roster push from the
server is supposed to reply with an IQ stanza of type "result" or
"error" (however, it is known that many existing clients do not reply
to roster pushes).
C:
type='result'/>
C:
type='result'/>
2.3.3
. Error Cases
If the server cannot successfully process the roster set, it MUST
return a stanza error. The following error cases are defined.
Naturally, other stanza errors can occur, such as
the roster get, or even
roster modifications by means of a non-XMPP method such as a web
interface.
Saint-Andre Standards Track [Page 18]
RFC 6121
XMPP IM March 2011
The server MUST return a
the sender of the roster set is not authorized to update the roster
(where typically only an authenticated resource of the account itself
is authorized).
The server MUST return a
the roster set contains any of the following violations:
1. The
element.
2. The
there are duplicate groups (one possible comparison method for
determining duplicates is that described for XMPP resourceparts
in [
XMPP-ADDR
]).
The server MUST return a
if the roster set contains any of the following violations:
1. The length of the 'name' attribute is greater than a server-
configured limit.
2. The XML character data of the
(to remove an item from all groups, the client instead needs to
exclude any
3. The XML character data of the
server-configured limit.
Error: Roster set initiated by unauthorized entity
C:
to='romeo@example.net'
type='set'>
S:
type='error'>
Saint-Andre Standards Track [Page 19]
RFC 6121
XMPP IM March 2011
Error: Roster set contains more than one item
C:
type='set'>
S:
type='error'>
Error: Roster set contains item with oversized handle
C:
type='set'>
S:
type='error'>
Error: Roster set contains duplicate groups
Saint-Andre Standards Track [Page 20]
RFC 6121
XMPP IM March 2011
C:
type='set'>
S:
type='error'>
Error: Roster set contains empty group
C:
type='set'>
S:
type='error'>
Error: Roster set contains oversized group name
Saint-Andre Standards Track [Page 21]
RFC 6121
XMPP IM March 2011
C:
type='set'>
S:
type='error'>
Interoperability Note: Some servers return a
error to the client if the value of the
attribute matches the bare JID
user's account.
2.4
. Updating a Roster Item
2.4.1
. Request
Updating an existing roster item is done in the same way as adding a
new roster item, i.e., by sending a roster set to the server.
Because a roster item is atomic, the item MUST be updated exactly as
provided in the roster set.
There are several reasons why a client might update a roster item:
1. Adding a group
2. Deleting a group
3. Changing the handle
4. Deleting the handle
Saint-Andre Standards Track [Page 22]
RFC 6121
XMPP IM March 2011
Consider a roster item that is defined as follows:
The user who has this item in her roster might want to add the item
to another group.
C:
type='set'>
Sometime later, the user might want to remove the item from the
original group.
C:
type='set'>
The user might want to remove the item from all groups.
C:
type='set'>
The user might also want to change the handle for the item.
Saint-Andre Standards Track [Page 23]
RFC 6121
XMPP IM March 2011
C:
type='set'>
The user might then want to remove the handle altogether.
C:
type='set'>
Implementation Note: Including an empty 'name' attribute is
equivalent to including no 'name' attribute; both actions set the
name to the empty string.
2.4.2
. Success Case
As with adding a roster item, if the roster item can be successfully
processed then the server MUST update the item in the user's roster,
send a roster push to all of the user's interested resources, and
send an IQ result to the initiating resource; details are provided
under
Section 2.3
2.4.3
. Error Cases
The error cases described under
Section 2.3.3
also apply to updating
a roster item.
2.5
. Deleting a Roster Item
2.5.1
. Request
At any time, a client can delete an item from his or her roster by
sending a roster set and specifying a value of "remove" for the
'subscription' attribute.
Saint-Andre Standards Track [Page 24]
RFC 6121
XMPP IM March 2011
C:
type='set'>
2.5.2
. Success Case
As with adding a roster item, if the server can successfully process
the roster set then it MUST update the item in the user's roster,
send a roster push to all of the user's interested resources (with
the 'subscription' attribute set to a value of "remove"), and send an
IQ result to the initiating resource; details are provided under
Section 2.3
In addition, the user's server might need to generate one or more
subscription-related presence stanzas, as follows:
1. If the user has a presence subscription to the contact, then the
user's server MUST send a presence stanza of type "unsubscribe"
to the contact (in order to unsubscribe from the contact's
presence).
2. If the contact has a presence subscription to the user, then the
user's server MUST send a presence stanza of type "unsubscribed"
to the contact (in order to cancel the contact's subscription to
the user).
3. If the presence subscription is mutual, then the user's server
MUST send both a presence stanza of type "unsubscribe" and a
presence stanza of type "unsubscribed" to the contact.
S:
to='nurse@example.com'
type='unsubscribe'/>
S:
to='nurse@example.com'
type='unsubscribed'/>
Saint-Andre Standards Track [Page 25]
RFC 6121
XMPP IM March 2011
2.5.3
. Error Cases
If the value of the 'jid' attribute specifies an item that is not in
the roster, then the server MUST return an
error.
Error: Roster item not found
C:
type='set'>
S:
type='error'>
2.6
. Roster Versioning
2.6.1
. Stream Feature
If a server supports roster versioning, then it MUST advertise the
following stream feature during stream negotiation.
The roster versioning stream feature is merely informative and
therefore is never mandatory-to-negotiate.
2.6.2
. Request
If a client supports roster versioning and the server to which it has
connected advertises support for roster versioning as described in
the foregoing section, then the client SHOULD include the 'ver'
element in its request for the roster. If the server does not
advertise support for roster versioning, the client MUST NOT include
the 'ver' attribute. If the client includes the 'ver' attribute in
its roster get, it sets the attribute's value to the version ID
associated with its last cache of the roster.
Saint-Andre Standards Track [Page 26]
RFC 6121
XMPP IM March 2011
C:
to='romeo@example.net'
type='get'>
If the client has not yet cached the roster or the cache is lost or
corrupted, but the client wishes to bootstrap the use of roster
versioning, it MUST set the 'ver' attribute to the empty string
(i.e., ver="").
Naturally, if the client does not support roster versioning or does
not wish to bootstrap the use of roster versioning, it will not
include the 'ver' attribute.
2.6.3
. Success Case
Whether or not the roster has been modified since the version ID
enumerated by the client, the server MUST either return the complete
roster as described under
Section 2.1.4
(including a 'ver' attribute
that signals the latest version) or return an empty IQ-result (thus
indicating that any roster modifications will be sent via roster
pushes, as described below). In general, unless returning the
complete roster would (1) use less bandwidth than sending individual
roster pushes to the client (e.g., if the roster contains only a few
items) or (2) the server cannot associate the version ID with any
previous version it has on file, the server SHOULD send an empty IQ-
result and then send the modifications (if any) via roster pushes.
S:
to='romeo@example.net/home'
type='result'/>
Implementation Note: This empty IQ-result is different from an
empty
empty roster.
If roster versioning is enabled and the roster has not been modified
since the version ID enumerated by the client, the server will simply
not send any roster pushes to the client (until and unless some
relevant event triggers a roster push during the lifetime of the
client's session).
Saint-Andre Standards Track [Page 27]
RFC 6121
XMPP IM March 2011
If the roster has been modified since the version ID enumerated by
the client, the server MUST then send one roster push to the client
for each roster item that has been modified since the version ID
enumerated by the client. (We call a roster push that is sent for
purposes of roster version synchronization an "interim roster push".)
Definition: A "roster modification" is any change to the roster
data that would result in a roster push to a connected client.
Therefore, internal states related to roster processing within the
server that would not result in a roster push to a connected
client do not necessitate a change to the version.
S:
to='romeo@example.net/home'
type='set'>
S:
to='romeo@example.net/home'
type='set'>
S:
to='romeo@example.net/home'
type='set'>
subscription='to'>
Saint-Andre Standards Track [Page 28]
RFC 6121
XMPP IM March 2011
S:
to='romeo@example.net/home'
type='set'>
subscription='both'>
These "interim roster pushes" can be understood as follows:
1. Imagine that the client had an active presence session for the
entire time between its cached roster version (say, "ver14") and
the new roster version (say, "ver96").
2. During that time, the client might have received roster pushes
related to various roster versions (which might have been, say,
"ver51" and "ver79"). However, some of those roster pushes might
have contained intermediate updates to the same roster item
(e.g., modifications to the subscription state for
bill@example.org from "none" to "to" and from "to" to "both").
3. The interim roster pushes would not include all of the
intermediate steps, only the final result of all modifications
applied to each item while the client was in fact offline (which
might have been, say, "ver34", "ver42", "ver72", and "ver96").
The client MUST handle an "interim roster push" in the same way it
handles any roster push (indeed, from the client's perspective it
cannot tell the difference between an "interim" roster push and a
"live" roster push and therefore it has no way of knowing when it has
received all of the interim roster pushes). When requesting the
roster after reconnection, the client SHOULD request the version
associated with the last roster push it received during its previous
session, not the version associated with the roster result it
received at the start of its previous session.
When roster versioning is enabled, the server MUST include the
updated roster version with each roster push. Roster pushes MUST
occur in order of modification and the version contained in a roster
push MUST be unique. Even if the client has not included the 'ver'
attribute in its roster gets or sets, the server SHOULD include the
'ver' attribute on all roster pushes and results that it sends to the
client.
Saint-Andre Standards Track [Page 29]
RFC 6121
XMPP IM March 2011
Implementation Note: Guidelines and more detailed examples for
roster versioning are provided in [
XEP-0237
].
. Managing Presence Subscriptions
In order to protect the privacy of XMPP users, presence information
is disclosed only to other entities that a user has approved. When a
user has agreed that another entity is allowed to view its presence,
the entity is said to have a "subscription" to the user's presence.
An entity that has a subscription to a user's presence or to which a
user has a presence subscription is called a "contact" (in this
document the term "contact" is also used in a less strict sense to
refer to a potential contact or any item in a user's roster).
In XMPP, a subscription lasts across presence sessions; indeed, it
lasts until the contact unsubscribes or the user cancels the
previously granted subscription. (This model is different from that
used for presence subscriptions in the Session Initiation Protocol
(SIP), as defined in [
SIP-PRES
].)
Subscriptions are managed within XMPP by sending presence stanzas
containing specially defined attributes ("subscribe", "unsubscribe",
"subscribed", and "unsubscribed").
Implementation Note: When a server processes or generates an
outbound presence stanza of type "subscribe", "subscribed",
"unsubscribe", or "unsubscribed", the server MUST stamp the
outgoing presence stanza with the bare JID
of the sending entity, not the full JID
simplifies the presence subscription model and helps to prevent
presence leaks; for information about presence leaks, refer to the
security considerations of [
XMPP-CORE
].
Subscription states are reflected in the rosters of both the user and
the contact. This section does not cover every possible case related
to presence subscriptions, and mainly narrates the protocol flows for
bootstrapping a mutual subscription between a user and a contact.
Complete details regarding subscription states can be found under
Appendix A
3.1
. Requesting a Subscription
A "subscription request" is a request from a user for authorization
to permanently subscribe to a contact's presence information;
syntactically it is a presence stanza whose 'type' attribute has a
value of "subscribe". A subscription request is generated by a
Saint-Andre Standards Track [Page 30]
RFC 6121
XMPP IM March 2011
user's client, processed by the (potential) contact's server, and
acted on by the contact via the contact's client. The workflow is
described in the following sections.
Implementation Note: Presence subscription requests are sent to
available resources, whereas the roster pushes associated with
subscription state changes are sent to interested resources.
Therefore, if a resource wishes to receive both subscription
requests and roster pushes, it MUST both send initial presence and
request the roster.
3.1.1
. Client Generation of Outbound Subscription Request
A user's client generates a subscription request by sending a
presence stanza of type "subscribe" and specifying a 'to' address of
the potential contact's bare JID
UC:
type='subscribe'/>
When a user sends a presence subscription request to a potential
instant messaging and presence contact, the value of the 'to'
attribute MUST be a bare JID
JID
for the user to receive presence from all of the contact's resources,
not merely the particular resource specified in the 'to' attribute.
Use of bare JIDs also simplifies subscription processing, presence
probes, and presence notifications by the user's server and the
contact's server.
For tracking purposes, a client SHOULD include an 'id' attribute in a
presence subscription request.
Implementation Note: Many XMPP clients prompt the user for
information about the potential contact (e.g., "handle" and
desired roster group) when generating an outbound presence
subscription request and therefore send a roster set before
sending the outbound presence subscription request. This behavior
is OPTIONAL, because a client MAY instead wait until receiving the
initial roster push from the server before uploading user-provided
information about the contact. A server MUST process a roster set
and outbound presence subscription request in either order (i.e.,
in whatever order generated by the client).
Saint-Andre Standards Track [Page 31]
RFC 6121
XMPP IM March 2011
3.1.2
. Server Processing of Outbound Subscription Request
Upon receiving the outbound presence subscription request, the user's
server MUST proceed as follows.
1. Before processing the request, the user's server MUST check the
syntax of the JID contained in the 'to' attribute (however, it is
known that some existing implementations do not perform this
check). If the JID is of the form
request had been directed to the contact's bare JID and modify
the 'to' address accordingly. The server MAY also verify that
the JID adheres to the format defined in [
XMPP-ADDR
] and possibly
return a
2. If the potential contact is hosted on the same server as the
user, then the server MUST adhere to the rules specified under
Section 3.1.3
when processing the subscription request and
delivering it to the (local) contact.
3. If the potential contact is hosted on a remote server, subject to
local service policies the user's server MUST then route the
stanza to that remote domain in accordance with core XMPP stanza
processing rules. (This can result in returning an appropriate
stanza error to the user, such as
As mentioned, before locally delivering or remotely routing the
presence subscription request, the user's server MUST stamp the
outbound subscription request with the bare JID
the user.
US:
to='juliet@example.com'
type='subscribe'/>
If the presence subscription request cannot be locally delivered or
remotely routed (e.g., because the request is malformed, the local
contact does not exist, the remote server does not exist, an attempt
to contact the remote server times out, or any other error is
determined or experienced by the user's server), then the user's
server MUST return an appropriate error stanza to the user. An
example follows.
Saint-Andre Standards Track [Page 32]
RFC 6121
XMPP IM March 2011
US:
to='romeo@example.net'
type='error'>
After locally delivering or remotely routing the presence
subscription request, the user's server MUST then send a roster push
to all of the user's interested resources, containing the potential
contact with a subscription state of "none" and with notation that
the subscription is pending (via an 'ask' attribute whose value is
"subscribe").
US:
type='set'>
subscription='none'/>
US:
type='set'>
subscription='none'/>
If a remote contact does not approve or deny the subscription request
within some configurable amount of time, the user's server SHOULD
resend the subscription request to the contact based on an
implementation-specific algorithm (e.g., whenever a new resource
becomes available for the user, or after a certain amount of time has
elapsed); this helps to recover from transient, silent errors that
might have occurred when the original subscription request was routed
to the remote domain. When doing so, it is RECOMMENDED for the
server to include an 'id' attribute so that it can track responses to
the resent subscription request.
Saint-Andre Standards Track [Page 33]
RFC 6121
XMPP IM March 2011
3.1.3
. Server Processing of Inbound Subscription Request
Before processing the inbound presence subscription request, the
contact's server SHOULD check the syntax of the JID contained in the
'to' attribute. If the JID is of the form
the contact's server SHOULD treat it as if the request had been
directed to the contact's bare JID and modify the 'to' address
accordingly. The server MAY also verify that the JID adheres to the
format defined in [
XMPP-ADDR
] and possibly return a
stanza error.
When processing the inbound presence subscription request, the
contact's server MUST adhere to the following rules:
1. Above all, the contact's server MUST NOT automatically approve
subscription requests on the contact's behalf -- unless the
contact has (a) pre-approved subscription requests from the user
as described under
Section 3.4
, (b) configured its account to
automatically approve subscription requests, or (c) accepted an
agreement with its service provider that allows automatic
approval (for instance, via an employment agreement within an
enterprise deployment). Instead, if a subscription request
requires approval then the contact's server MUST deliver that
request to the contact's available resource(s) for approval or
denial by the contact.
2. If the contact exists and the user already has a subscription to
the contact's presence, then the contact's server MUST auto-reply
on behalf of the contact by sending a presence stanza of type
"subscribed" from the contact's bare JID to the user's bare JID.
Likewise, if the contact previously sent a presence stanza of
type "subscribed" and the contact's server treated that as
indicating "pre-approval" for the user's presence subscription
(see
Section 3.4
), then the contact's server SHOULD also auto-
reply on behalf of the contact.
CS:
to='romeo@example.net'
type='subscribed'/>
3. Otherwise, if there is at least one available resource associated
with the contact when the subscription request is received by the
contact's server, then the contact's server MUST send that
subscription request to all available resources in accordance
with
Section 8
. As a way of acknowledging receipt of the
presence subscription request, the contact's server MAY send a
Saint-Andre Standards Track [Page 34]
RFC 6121
XMPP IM March 2011
presence stanza of type "unavailable" from the bare JID of the
contact to the bare JID of the user (the user's client MUST NOT
assume that this acknowledgement provides presence information
about the contact, since it comes from the contact's bare JID and
is received before the subscription request has been approved).
4. Otherwise, if the contact has no available resources when the
subscription request is received by the contact's server, then
the contact's server MUST keep a record of the complete presence
stanza comprising the subscription request, including any
extended content contained therein (see Section 8.4 of
XMPP-CORE
]), and then deliver the request when the contact next
has an available resource. The contact's server MUST continue to
deliver the subscription request whenever the contact creates an
available resource, until the contact either approves or denies
the request. (The contact's server MUST NOT deliver more than
one subscription request from any given user when the contact
next has an available resource; e.g., if the user sends multiple
subscription requests to the contact while the contact is
offline, the contact's server SHOULD store only one of those
requests, such as the first request or last request, and MUST
deliver only one of the requests when the contact next has an
available resource; this helps to prevent "subscription request
spam".)
Security Warning: Until and unless the contact approves the
subscription request as described under
Section 3.1.4
, the
contact's server MUST NOT add an item for the user to the
contact's roster.
Security Warning: The mandate for the contact's server to store
the complete stanza of the presence subscription request
introduces the possibility of an application resource exhaustion
attack (see Section 2.1.2 of [
DOS
]), for example, by a rogue
server or a coordinated group of users (e.g., a botnet) against
the contact's server or particular contact. Server implementers
are advised to consider the possibility of such attacks and
provide tools for counteracting it, such as enabling service
administrators to set limits on the number or size of inbound
presence subscription requests that the server will store in
aggregate or for any given contact.
3.1.4
. Client Processing of Inbound Subscription Request
When an interactive client receives a subscription request, it MUST
present the request to the natural person controlling the client
(i.e., the "contact") for approval, unless the contact has explicitly
configured the client to automatically approve or deny some or all
Saint-Andre Standards Track [Page 35]
RFC 6121
XMPP IM March 2011
subscription requests as described above. An automated client that
is not controlled by a natural person will have its own application-
specific rules for approving or denying subscription requests.
A client approves a subscription request by sending a presence stanza
of type "subscribed", which is processed as described under
Section 3.1.5
for the contact's server and
Section 3.1.6
for the
user's server.
CC:
type='subscribed'/>
A client denies a subscription request by sending a presence stanza
of type "unsubscribed", which is processed as described under
Section 3.2
for both the contact's server and the user's server.
CC:
type='unsubscribed'/>
For tracking purposes, a client SHOULD include an 'id' attribute in a
subscription approval or subscription denial; this 'id' attribute
MUST NOT mirror the 'id' attribute of the subscription request.
3.1.5
. Server Processing of Outbound Subscription Approval
When the contact's client sends the subscription approval, the
contact's server MUST stamp the outbound stanza with the bare JID
route the stanza to the user.
CS:
to='romeo@example.net'
type='subscribed'/>
The contact's server then MUST send an updated roster push to all of
the contact's interested resources, with the 'subscription' attribute
set to a value of "from". (Here we assume that the contact does not
already have a subscription to the user; if that were the case, the
'subscription' attribute would be set to a value of "both", as
explained under
Appendix A
.)
Saint-Andre Standards Track [Page 36]
RFC 6121
XMPP IM March 2011
CS:
type='set'>
CS:
type='set'>
From the perspective of the contact, there now exists a subscription
from the user, which is why the 'subscription' attribute is set to a
value of "from". (Here we assume that the contact does not already
have a subscription to the user; if that were the case, the
'subscription' attribute would be set to a value of "both", as
explained under
Appendix A
.)
The contact's server MUST then also send current presence to the user
from each of the contact's available resources.
CS:
to='romeo@example.net'/>
CS:
to='romeo@example.net'/>
In order to subscribe to the user's presence, the contact would then
need to send a subscription request to the user. (XMPP clients will
often automatically send the subscription request instead of
requiring the contact to initiate the subscription request, since it
is assumed that the desired end state is a mutual subscription.)
Naturally, when the contact sends a subscription request to the user,
the subscription states will be different from those shown in the
foregoing examples (see
Appendix A
) and the roles will be reversed.
Saint-Andre Standards Track [Page 37]
RFC 6121
XMPP IM March 2011
3.1.6
. Server Processing of Inbound Subscription Approval
When the user's server receives a subscription approval, it MUST
first check if the contact is in the user's roster with
subscription='none' or subscription='from' and the 'ask' flag set to
"subscribe" (i.e., a subscription state of "None + Pending Out",
"None + Pending Out+In", or "From + Pending Out"; see
Appendix A
).
If this check is successful, then the user's server MUST:
1. Deliver the inbound subscription approval to all of the user's
interested resources (this helps to give the user's client(s)
proper context regarding the subscription approval so that they
can differentiate between a roster push originated by another of
the user's resources and a subscription approval received from
the contact). This MUST occur before sending the roster push
described in the next step.
US:
to='romeo@example.net'
type='subscribed'/>
2. Initiate a roster push to all of the user's interested resources,
containing an updated roster item for the contact with the
'subscription' attribute set to a value of "to" (if the
subscription state was "None + Pending Out" or "None + Pending
Out+In") or "both" (if the subscription state was "From + Pending
Out").
US:
type='set'>
US:
type='set'>
Saint-Andre Standards Track [Page 38]
RFC 6121
XMPP IM March 2011
3. The user's server MUST also deliver the available presence stanza
received from each of the contact's available resources to each
of the user's available resources.
[ ... to resource1 ... ]
US:
to='romeo@example.net'/>
[ ... to resource2 ... ]
US:
to='romeo@example.net'/>
[ ... to resource1 ... ]
US:
to='romeo@example.net'/>
[ ... to resource2 ... ]
US:
to='romeo@example.net'/>
Implementation Note: If the user's account has no available
resources when the inbound subscription approval notification is
received, the user's server MAY keep a record of the notification
(ideally the complete presence stanza) and then deliver the
notification when the account next has an available resource.
This behavior provides more complete signaling to the user
regarding the reasons for the roster change that occurred while
the user was offline.
Otherwise -- that is, if the user does not exist, if the contact is
not in the user's roster, or if the contact is in the user's roster
with a subscription state other than those described in the foregoing
check -- then the user's server MUST silently ignore the subscription
approval notification by not delivering it to the user, not modifying
the user's roster, and not generating a roster push to the user's
interested resources.
From the perspective of the user, there now exists a subscription to
the contact's presence (which is why the 'subscription' attribute is
set to a value of "to").
Saint-Andre Standards Track [Page 39]
RFC 6121
XMPP IM March 2011
3.2
. Canceling a Subscription
3.2.1
. Client Generation of Subscription Cancellation
If a contact would like to cancel a subscription that it has
previously granted to a user, to cancel a subscription pre-approval
Section 3.4
), or to deny a subscription request, it sends a presence
stanza of type "unsubscribed".
CC:
type='unsubscribed'/>
3.2.2
. Server Processing of Outbound Subscription Cancellation
Upon receiving the outbound subscription cancellation, the contact's
server MUST proceed as follows.
1. If the user's bare JID is not yet in the contact's roster or is
in the contact's roster with a state of "None", "None + Pending
Out", or "To", the contact's server SHOULD NOT route or deliver
the presence stanza of type "unsubscribed" to the user and MUST
NOT send presence notifications of type "unavailable" to the user
as described below.
2. If the user's bare JID is in the contact's roster with a state of
"None", "None + Pending Out", or "To" and the 'approved' flag is
set to "true" (thus signaling a subscription pre-approval as
described under
Section 3.4
), the contact's server MUST remove
the pre-approval and MUST NOT route or deliver the presence
stanza of type "unsubscribed" to the user.
3. Otherwise, as shown in the following examples, the contact's
server MUST route or deliver both presence notifications of type
"unavailable" and presence stanzas of type "unsubscribed" to the
user and MUST send a roster push to the contact.
While the user is still subscribed to the contact's presence (i.e.,
before the contact's server routes or delivers the presence stanza of
type "unsubscribed" to the user), the contact's server MUST send a
presence stanza of type "unavailable" from all of the contact's
online resources to the user.
Saint-Andre Standards Track [Page 40]
RFC 6121
XMPP IM March 2011
CS:
type='unavailable'/>
CS:
type='unavailable'/>
Then the contact's server MUST route or deliver the presence stanza
of type "unsubscribed" to the user, making sure to stamp the outbound
subscription cancellation with the bare JID
the contact.
CS:
to='romeo@example.net'
type='unsubscribed'/>
The contact's server then MUST send a roster push with the updated
roster item to all of the contact's interested resources, where the
subscription state is now either "none" or "to" (see
Appendix A
).
CS:
type='set'>
CS:
type='set'>
3.2.3
. Server Processing of Inbound Subscription Cancellation
When the user's server receives the inbound subscription
cancellation, it MUST first check if the contact is in the user's
roster with subscription='to' or subscription='both' (see
Appendix A
). If this check is successful, then the user's server
MUST:
Saint-Andre Standards Track [Page 41]
RFC 6121
XMPP IM March 2011
1. Deliver the inbound subscription cancellation to all of the
user's interested resources (this helps to give the user's
client(s) proper context regarding the subscription cancellation
so that they can differentiate between a roster push originated
by another of the user's resources and a subscription
cancellation received from the contact). This MUST occur before
sending the roster push described in the next step.
US:
to='romeo@example.net'
type='unsubscribed'/>
2. Initiate a roster push to all of the user's interested resources,
containing an updated roster item for the contact with the
'subscription' attribute set to a value of "none" (if the
subscription state was "To" or "To + Pending In") or "from" (if
the subscription state was "Both").
US:
type='set'>
US:
type='set'>
The user's server MUST also deliver the inbound presence stanzas of
type "unavailable".
Implementation Note: If the user's account has no available
resources when the inbound unsubscribed notification is received,
the user's server MAY keep a record of the notification (ideally
the complete presence stanza) and then deliver the notification
when the account next has an available resource. This behavior
provides more complete signaling to the user regarding the reasons
for the roster change that occurred while the user was offline.
Saint-Andre Standards Track [Page 42]
RFC 6121
XMPP IM March 2011
Otherwise -- that is, if the user does not exist, if the contact is
not in the user's roster, or if the contact is in the user's roster
with a subscription state other than those described in the foregoing
check -- then the user's server MUST silently ignore the unsubscribed
notification by not delivering it to the user, not modifying the
user's roster, and not generating a roster push to the user's
interested resources.
3.3
. Unsubscribing
3.3.1
. Client Generation of Unsubscribe
If a user would like to unsubscribe from a contact's presence, it
sends a presence stanza of type "unsubscribe".
UC:
type='unsubscribe'/>
3.3.2
. Server Processing of Outbound Unsubscribe
Upon receiving the outbound unsubscribe, the user's server MUST
proceed as follows.
1. If the contact is hosted on the same server as the user, then the
server MUST adhere to the rules specified under
Section 3.3.3
when processing the subscription request.
2. If the contact is hosted on a remote server, subject to local
service policies the user's server MUST then route the stanza to
that remote domain in accordance with core XMPP stanza processing
rules. (This can result in returning an appropriate stanza error
to the user, such as
As mentioned, before locally delivering or remotely routing the
unsubscribe, the user's server MUST stamp the stanza with the bare
JID
US:
to='juliet@example.com'
type='unsubscribe'/>
The user's server then MUST send a roster push with the updated
roster item to all of the user's interested resources, where the
subscription state is now either "none" or "from" (see
Appendix A
).
Saint-Andre Standards Track [Page 43]
RFC 6121
XMPP IM March 2011
US:
type='set'>
US:
id='h37h3u1bv403'>
3.3.3
. Server Processing of Inbound Unsubscribe
When the contact's server receives the unsubscribe notification, it
MUST first check if the user's bare JID is in the contact's roster
with subscription='from' or subscription='both' (i.e., a subscription
state of "From", "From + Pending Out", or "Both"; see
Appendix A
).
If this check is successful, then the contact's server MUST:
1. Deliver the inbound unsubscribe to all of the contact's
interested resources (this helps to give the contact's client(s)
proper context regarding the unsubscribe so that they can
differentiate between a roster push originated by another of the
contact's resources and an unsubscribe received from the user).
This MUST occur before sending the roster push described in the
next step.
CS:
to='juliet@example.com'
type='unsubscribe'/>
2. Initiate a roster push to all of the contact's interested
resources, containing an updated roster item for the user with
the 'subscription' attribute set to a value of "none" (if the
subscription state was "From" or "From + Pending Out") or "to"
(if the subscription state was "Both").
Saint-Andre Standards Track [Page 44]
RFC 6121
XMPP IM March 2011
CS:
type='set'>
CS:
type='set'>
3. Generate an outbound presence stanza of type "unavailable" from
each of the contact's available resources to the user.
CS:
to='romeo@example.net'
type='unavailable'/>
CS:
to='romeo@example.net'
type='unavailable'/>
Implementation Note: If the contact's account has no available
resources when the inbound unsubscribe notification is received,
the contact's server MAY keep a record of the notification
(ideally the complete presence stanza) and then deliver the
notification when the account next has an available resource.
This behavior provides more complete signaling to the user
regarding the reasons for the roster change that occurred while
the user was offline.
Otherwise -- that is, if the contact does not exist, if the user is
not in the contact's roster, or if the user's bare JID is in the
contact's roster with a subscription state other than those described
in the foregoing check -- then the contact's server MUST silently
ignore the unsubscribe stanza by not delivering it to the contact,
not modifying the contact's roster, and not generating a roster push
to the contact's interested resources. However, if the contact's
server is keeping track of an inbound presence subscription request
Saint-Andre Standards Track [Page 45]
RFC 6121
XMPP IM March 2011
from the user to the contact but the user is not yet in the contact's
roster (functionally equivalent to a subscription state of "None +
Pending In" where the contact never added the user to the contact's
roster), then the contact's server MUST simply remove any record of
the inbound presence subscription request (it cannot remove the user
from the contact's roster because the user was never added to the
contact's roster).
Implementation Note: The user's client MUST NOT depend on
receiving the unavailable presence notification from the contact,
since it MUST consider its presence subscription to the contact,
and its presence information about the contact, to be null and
void when it sends the presence stanza of type "unsubscribe" or
when it receives the roster push triggered by the unsubscribe
request.
3.4
. Pre-Approving a Subscription Request
If a user has not received a subscription request from a contact, the
user can "pre-approve" such a request so that it will be
automatically approved by the user's server.
Support for subscription pre-approvals is OPTIONAL on the part of
clients and servers. If a server supports subscription pre-
approvals, then it MUST advertise the following stream feature during
stream negotiation.
The subscription pre-approval stream feature is merely informative
and therefore is never mandatory-to-negotiate.
3.4.1
. Client Generation of Subscription Pre-Approval
If the server to which a client connects has advertised support for
subscription pre-approvals, the client MAY generate a subscription
pre-approval by sending a presence stanza of type "subscribed" to the
contact.
UC:
type='subscribed'/>
If the server does not advertise support for subscription pre-
approvals, the client MUST NOT attempt to pre-approve subscription
requests from potential or actual contacts.
Saint-Andre Standards Track [Page 46]
RFC 6121
XMPP IM March 2011
3.4.2
. Server Processing of Subscription Pre-Approval
Upon receiving the presence stanza of type "subscribed", the user's
server MUST proceed as follows if it supports subscription pre-
approvals.
1. If the contact is in the user's roster with a state of "Both",
"From", or "From + Pending Out", the user's server MUST silently
ignore the stanza.
2. If the contact is in the user's roster with a state of "To +
Pending In", "None + Pending In", or "None + Pending Out+In", the
user's server MUST handle the stanza as a normal subscription
approval (see under
Section 3.1.5
) by updating the existing
roster item to a state of "Both", "From", or "From + Pending Out"
(respectively), pushing the modified roster item to all of the
user's interested resources, and routing the presence stanza of
type "subscribed" to the contact.
3. If the contact is in the user's roster with a state of "To",
"None", or "None + Pending Out", the user's server MUST note the
subscription pre-approval by setting the 'approved' flag to a
value of "true", then push the modified roster item to all of the
user's interested resources. However, the user's server MUST NOT
route the presence stanza of type "subscribed" to the contact.
4. If the contact is not yet in the user's roster, the user's server
MUST create a roster item for the contact with a state of "None"
and set the 'approved' flag to a value of "true", then push the
roster item to all of the user's interested resources. However,
the user's server MUST NOT route the presence stanza of type
"subscribed" to the contact.
An example of the roster push follows.
US:
type='set'>
subscription='none'/>
When the 'approved' flag is set to "true", the user's server MUST NOT
deliver a presence stanza of type "subscribe" from the contact to the
user, but instead MUST automatically respond to such a stanza on
Saint-Andre Standards Track [Page 47]
RFC 6121
XMPP IM March 2011
behalf of the user by returning a presence stanza of type
"subscribed" from the bare JID of the user to the bare JID of the
contact.
Implementation Note: It is a matter of implementation or local
service policy whether the server maintains a record of the
subscription approval after it has received a presence
subscription request from the contact. If the server does not
maintain such a record, upon receiving the subscription request it
will not include the 'approved' attribute in the roster item for
the contact (i.e., in subsequent roster pushes and roster
results). If the server maintains such a record, it will always
include the 'approved' attribute (set to "true") in the roster
item for the contact, until and unless the user sends a presence
stanza of type "unsubscribed" to the contact (or removes the
contact from the roster entirely).
Implementation Note: A client can cancel a pre-approval by sending
a presence stanza of type "unsubscribed", as described more fully
under
Section 3.2
. In this case, the user's server would send a
roster push to all of the user's interested resources with the
'approved' attribute removed. (Alternatively, the client can
simply remove the roster item entirely.)
. Exchanging Presence Information
4.1
. Presence Fundamentals
The concept of presence refers to an entity's availability for
communication over a network. At the most basic level, presence is a
boolean "on/off" variable that signals whether an entity is available
or unavailable for communication (the terms "online" and "offline"
are also used). In XMPP, an entity's availability is signaled when
its client generates a
and an entity's lack of availability is signaled when its client
generates a
"unavailable".
XMPP presence typically follows a "publish-subscribe" or "observer"
pattern, wherein an entity sends presence to its server, and its
server then broadcasts that information to all of the entity's
contacts who have a subscription to the entity's presence (in the
terminology of [
IMP-MODEL
], an entity that generates presence is a
"presentity" and the entities that receive presence are
"subscribers"). A client generates presence for broadcast to all
subscribed entities by sending a presence stanza to its server with
no 'to' address, where the presence stanza has either no 'type'
attribute or a 'type' attribute whose value is "unavailable". This
Saint-Andre Standards Track [Page 48]
RFC 6121
XMPP IM March 2011
kind of presence is called "broadcast presence". (A client can also
send "directed presence", i.e., a presence stanza with a 'to'
address; this is less common but is sometimes used to send presence
to entities that are not subscribed to the user's presence; see
Section 4.6
.)
After a client completes the preconditions specified in [
XMPP-CORE
],
it can establish a "presence session" at its server by sending
initial presence (
Section 4.2
), where the presence session is
terminated by sending unavailable presence (
Section 4.5
). For the
duration of its presence session, a connected resource (in the
terminology of [
XMPP-CORE
]) is said to be an "available resource".
In XMPP, applications that combine messaging and presence
functionality, the default type of communication for which presence
signals availability is messaging; however, it is not necessary for
XMPP applications to combine messaging and presence functionality,
and they can provide standalone presence features without messaging
(in addition, XMPP servers do not require information about network
availability in order to successfully route message and IQ stanzas).
Informational Note: In the examples that follow, the user is
and "chamber"), and she has three contacts in her roster with a
subscription state of "from" or "both":
4.2
. Initial Presence
4.2.1
. Client Generation of Initial Presence
After completing the preconditions described in [
XMPP-CORE
(REQUIRED) and requesting the roster (RECOMMENDED), a client signals
its availability for communication by sending "initial presence" to
its server, i.e., a presence stanza with no 'to' address (indicating
that it is meant to be broadcast by the server on behalf of the
client) and no 'type' attribute (indicating the user's availability).
UC:
The initial presence stanza MAY contain the
as well as extended content; details are provided under
Section 4.7
Saint-Andre Standards Track [Page 49]
RFC 6121
XMPP IM March 2011
4.2.2
. Server Processing of Outbound Initial Presence
Upon receiving initial presence from a client, the user's server MUST
send the initial presence stanza from the full JID
subscribed to the user's presence; such contacts are those for which
a JID is present in the user's roster with the 'subscription'
attribute set to a value of "from" or "both".
US:
US:
US:
The user's server MUST also broadcast initial presence from the
user's newly available resource to all of the user's available
resources, including the resource that generated the presence
notification in the first place (i.e., an entity is implicitly
subscribed to its own presence).
[... to the "balcony" resource ...]
US:
[... to the "chamber" resource ...]
US:
In the absence of presence information about the user's contacts, the
user's server MUST also send presence probes to the user's contacts
on behalf of the user as specified under
Section 4.3
4.2.3
. Server Processing of Inbound Initial Presence
Upon receiving presence from the user, the contact's server MUST
deliver the user's presence stanza to all of the contact's available
resources.
[ ... to resource1 ... ]
CS:
Saint-Andre Standards Track [Page 50]
RFC 6121
XMPP IM March 2011
[ ... to resource2 ... ]
CS:
4.2.4
. Client Processing of Initial Presence
When the contact's client receives presence from the user, the
following behavior is suggested for interactive clients:
1. If the user's bare JID is in the contact's roster, display the
presence information in an appropriate roster interface.
2. If the user is not in the contact's roster but the contact and
the user are actively exchanging message or IQ stanzas, display
the presence information in the user interface for that
communication session (see also
Section 4.6
and
Section 5.1
).
3. Otherwise, ignore the presence information and do not display it
to the contact.
4.3
. Presence Probes
A "presence probe" is a request for a contact's current presence
information, sent on behalf of a user by the user's server;
syntactically it is a presence stanza whose 'type' attribute has a
value of "probe". In the context of presence subscriptions, the
value of the 'from' address MUST be the bare JID of the subscribed
user and the value of the 'to' address MUST be the bare JID of the
contact to which the user is subscribed, since presence subscriptions
are based on the bare JID.
US:
to='romeo@example.net'
type='probe'/>
Interoperability Note:
RFC 3921
specified that probes are sent
from the full JID, not the bare JID (a rule that was changed
because subscriptions are based on the bare JID). Some existing
implementations send from the full JID instead of the bare JID.
Probes can also be sent by an entity that has received presence
outside the context of a presence subscription, typically when the
contact has sent directed presence as described under
Section 4.6
; in
this case the value of the 'from' or 'to' address can be a full JID
instead of a bare JID. See
Section 4.6
for a complete discussion.
Saint-Andre Standards Track [Page 51]
RFC 6121
XMPP IM March 2011
Presence probes SHOULD NOT be sent by a client, because in general a
client will not need to send them since the task of gathering
presence from a user's contacts is managed by the user's server.
However, if a user's client generates an outbound presence probe then
the user's server SHOULD route the probe (if the contact is at
another server) or process the probe (if the contact is at the same
server) and MUST NOT use its receipt of the presence probe from a
connected client as the sole cause for returning a stanza or stream
error to the client.
4.3.1
. Server Generation of Outbound Presence Probe
When a server needs to discover the availability of a user's contact,
it sends a presence probe from the bare JID
user to the bare JID
Implementation Note: Although presence probes are intended for
sending to contacts (i.e., entities to which a user is
subscribed), a server MAY send a presence probe to the full JID of
an entity from which the user has received presence information
during the current session.
The user's server SHOULD send a presence probe whenever the user
starts a new presence session by sending initial presence; however,
the server MAY choose not to send the probe at that point if it has
what it deems to be reliable and up-to-date presence information
about the user's contacts (e.g., because the user has another
available resource or because the user briefly logged off and on
before the new presence session began). In addition, a server MAY
periodically send a presence probe to a contact if it has not
received presence information or other traffic from the contact in
some configurable amount of time; this can help to prevent "ghost"
contacts who appear to be online but in fact are not.
US:
to='romeo@example.net'
type='probe'/>
US:
to='mercutio@example.com'
type='probe'/>
Naturally, the user's server does not need to send a presence probe
to a contact if the contact's account resides on the same server as
the user, since the server possesses the contact's information
locally.
Saint-Andre Standards Track [Page 52]
RFC 6121
XMPP IM March 2011
4.3.2
. Server Processing of Inbound Presence Probe
Upon receiving a presence probe to the contact's bare JID from the
user's server on behalf of the user, the contact's server MUST reply
as follows:
1. If the contact account does not exist or the user's bare JID is
in the contact's roster with a subscription state other than
"From", "From + Pending Out", or "Both" (as explained under
Appendix A
), then the contact's server SHOULD return a presence
stanza of type "unsubscribed" in response to the presence probe
(this will trigger a protocol flow for canceling the user's
subscription to the contact as described under
Section 3.2
however, this MUST NOT result in cancellation of a subscription
pre-approval as described under
Section 3.4
). Here the 'from'
address MUST be the bare JID of the contact, since specifying a
full JID would constitute a presence leak as described in
XMPP-CORE
].
CS:
to='juliet@example.com'
type='unsubscribed'/>
However, if a server receives a presence probe from a configured
domain of the server itself or another such trusted service, it MAY
provide presence information about the user to that entity.
2. Else, if the contact has moved temporarily or permanently to
another address, then the server SHOULD return a presence stanza
of type "error" with a stanza error condition of
(temporary) or
of the contact.
CS:
to='juliet@example.com'
type='error'>
xmpp:la-mer@example.com
3. Else, if the contact has no available resources, then the server
SHOULD reply to the presence probe by sending to the user a
presence stanza of type "unavailable" (although sending
Saint-Andre Standards Track [Page 53]
RFC 6121
XMPP IM March 2011
unavailable presence here is preferable because it results in a
deterministic answer to the probe, it is not mandatory because it
can greatly increase the number of presence notifications
generated by the contact's server). Here the 'from' address is
the bare JID because there is no available resource associated
with the contact. If appropriate in accordance with local
security policies this presence notification MAY include the full
XML of the last unavailable presence stanza that the server
received from the contact (including the 'id' of the original
stanza), but if not then the presence notification SHOULD simply
indicate that the contact is unavailable without any of the
details originally provided. In any case, the presence
notification returned to the probing entity SHOULD include
information about the time when the last unavailable presence
stanza was generated (formatted using the XMPP delayed delivery
extension [
DELAY
]).
CS:
to='juliet@example.com'
type='unavailable'>
4. Else, if the contact has at least one available resource, then
the server MUST reply to the presence probe by sending to the
user the full XML of the last presence stanza with no 'to'
attribute received by the server from each of the contact's
available resources. Here the 'from' addresses are the full JIDs
of each available resource.
CS:
to='juliet@example.com'/>
CS:
to='juliet@example.com'>
Implementation Note: By "full XML" is meant the complete stanza
from the opening
including all elements and attributes whether qualified by the
content namespace or extended namespaces; however, in accordance
Saint-Andre Standards Track [Page 54]
RFC 6121
XMPP IM March 2011
with [
XMPP-CORE
], the contact's server will need to transform the
content namespace from 'jabber:client' to 'jabber:server' if it
sends the complete stanza over a server-to-server stream.
If the contact's server receives a presence probe addressed to a full
JID of the contact, the server MUST NOT return presence information
about any resource except the resource specified by the 'to' address
of the probe. Rules #1 and #2 for a bare JID probe apply equally to
the case of a full JID probe. If there is a resource matching the
full JID and the probing entity has authorization via a presence
subscription to see the contact's presence, then the server MUST
return an available presence notification, which SHOULD communicate
only the fact that the resource is available (not detailed
information such as the
extensions).
CS:
Implementation Note: See
Section 4.6
regarding rules that
supplement the foregoing for handling of directed presence.
4.3.2.1
. Handling of the 'id' Attribute
The handling of the 'id' attribute in relation to presence probes was
unspecified in
RFC 3921
. Although the pattern of "send a probe and
receive a reply" might seem like a request-response protocol similar
to the XMPP
probe might consist of multiple presence stanzas (one for each
available resource currently active for the contact). For this
reason, if the contact currently has available resources then the
contact's server SHOULD preserve the 'id' attribute of the contact's
original presence stanza (if any) when sending those presence
notifications to the probing entity. By contrast, if the contact
currently has no available resources, the probing entity is not
authorized (via presence subscription) to see the contact's presence,
or an error occurs in relation to the probe, then the contact's
server SHOULD mirror the 'id' of the user's presence probe when
replying to the probing entity.
The following examples illustrate the difference.
In the first scenario, Juliet sends presence from her "chamber"
resource.
Saint-Andre Standards Track [Page 55]
RFC 6121
XMPP IM March 2011
CC:
She also sends presence from her "balcony" resource.
CC:
Romeo's server then sends a probe to Juliet.
US:
Juliet's server then sends both of her presence notifications to
Romeo, preserving the 'id' attributes included in the stanzas that
her client has sent.
CS:
CS:
In the second scenario, Juliet is offline when Romeo's server sends a
probe.
US:
type='probe'/>
Juliet's server replies with an unavailable notification, mirroring
the 'id' of Rome's presence probe because there is no 'id' to
preserve from an available notification that her client has sent.
CS:
type='unavailable'/>
Saint-Andre Standards Track [Page 56]
RFC 6121
XMPP IM March 2011
4.4
. Subsequent Presence Broadcast
4.4.1
. Client Generation of Subsequent Presence Broadcast
After sending initial presence, at any time during its session the
user's client can update its availability for broadcast by sending a
presence stanza with no 'to' address and no 'type' attribute.
UC:
The presence broadcast MAY contain the
as well as extended content; details are provided under
Section 4.7
However, a user SHOULD send a presence update only to broadcast
information that is relevant to the user's availability for
communication or the communication capabilities of the resource.
Information that is not relevant in this way might be of interest to
the user's contacts but SHOULD be sent via other means, such as the
"publish-subscribe" method described in [
XEP-0163
].
4.4.2
. Server Processing of Subsequent Outbound Presence
Upon receiving a presence stanza expressing updated availability, the
user's server MUST broadcast the full XML of that presence stanza to
the contacts who are in the user's roster with a subscription type of
"from" or "both".
Interoperability Note:
RFC 3921
specified that the user's server
would check to make sure that it had not received a presence error
from the contact before sending subsequent presence notifications.
That rule has been removed because this specification uses
presence stanzas of type "unsubscribe" (not "error") to solve
subscription synchronization problems, in part because such
stanzas change the contact's subscription state in the user's
roster to either "none" or "to" (see
Section 3.3
and
Appendix A
),
thus obviating the need for the error check.
Interoperability Note: If the subscription type is "both", some
existing server implementations send subsequent presence
notifications to a contact only if the contact is online according
to the user's server (that is, if the user's server never received
a positive indication that the contact is online in response to
the presence probe it sent to the contact, the user's server does
not send subsequent presence notifications from the user to the
Saint-Andre Standards Track [Page 57]
RFC 6121
XMPP IM March 2011
contact). This behavior is perceived to save bandwidth, since
most presence subscriptions are bidirectional and many contacts
will not be online at any given time.
US:
US:
US:
Implementation Note: See
Section 4.6
regarding rules that
supplement the foregoing for handling of directed presence.
The user's server MUST also send the presence stanza to all of the
user's available resources (including the resource that generated the
presence notification in the first place).
US:
US:
4.4.3
. Server Processing of Subsequent Inbound Presence
Upon receiving presence from the user, the contact's server MUST
deliver the user's presence stanza to all of the contact's available
resources.
[ ... to resource1 ... ]
CS:
Saint-Andre Standards Track [Page 58]
RFC 6121
XMPP IM March 2011
[ ... to resource2 ... ]
CS:
4.4.4
. Client Processing of Subsequent Presence
From the perspective of the contact's client, there is no significant
difference between initial presence broadcast and subsequent
presence, so the contact's client follows the rules for processing of
inbound presence defined under
Section 4.4.3
4.5
. Unavailable Presence
4.5.1
. Client Generation of Unavailable Presence
Before ending its presence session with a server, the user's client
SHOULD gracefully become unavailable by sending "unavailable
presence", i.e., a presence stanza that possesses no 'to' attribute
and that possesses a 'type' attribute whose value is "unavailable".
UC:
Optionally, the unavailable presence stanza MAY contain one or more
available.
UC:
However, the unavailable presence stanza MUST NOT contain the
apply only to available resources.
4.5.2
. Server Processing of Outbound Unavailable Presence
The user's server MUST NOT depend on receiving unavailable presence
from an available resource, since the resource might become
unavailable ungracefully (e.g., the resource's XML stream might be
closed with or without a stream error for any of the reasons
described in [
XMPP-CORE
]).
Saint-Andre Standards Track [Page 59]
RFC 6121
XMPP IM March 2011
If an available resource becomes unavailable for any reason (either
gracefully or ungracefully), the user's server MUST broadcast
unavailable presence to all contacts that are in the user's roster
with a subscription type of "from" or "both".
Interoperability Note:
RFC 3921
specified that the user's server
would check to make sure that it had not received a presence error
from the contact before sending unavailable presence
notifications. That rule has been removed because this
specification uses presence stanzas of type "unsubscribe" (not
"error") to solve subscription synchronization problems, in part
because such stanzas change the contact's subscription state in
the user's roster to either "none" or "to" (see
Section 3.3
and
Appendix A
), thus obviating the need for the error check.
Implementation Note: Even if the user's server does not broadcast
the user's subsequent presence notifications to contacts who are
offline (as described under
Section 4.4.2
), it MUST broadcast the
user's unavailable presence notification; if it did not do so, the
last presence received by the contact's server would be the user's
initial presence for the presence session, with the result that
the contact would consider the user to be online.
Implementation Note: See
Section 4.6
regarding rules that
supplement the foregoing for handling of directed presence.
If the unavailable notification was gracefully received from the
client, then the server MUST broadcast the full XML of the presence
stanza.
US:
type='unavailable'>
US:
type='unavailable'>
US:
type='unavailable'>
Saint-Andre Standards Track [Page 60]
RFC 6121
XMPP IM March 2011
The user's server MUST also send the unavailable notification to all
of the user's available resources (as well as to the resource that
generated the unavailable presence in the first place).
US:
type='unavailable'>
If the server detects that the user has gone offline ungracefully,
then the server MUST generate the unavailable presence broadcast on
the user's behalf.
Implementation Note: Any presence stanza with no 'type' attribute
and no 'to' attribute that the client sends after the server
broadcasts or generates an unavailable presence notification MUST
be routed or delivered by the user's server to all subscribers
(i.e., MUST be treated as equivalent to initial presence for a new
presence session).
4.5.3
. Server Processing of Inbound Unavailable Presence
Upon receiving an unavailable notification from the user, the
contact's server MUST deliver the user's presence stanza to all of
the contact's available resources.
[ ... to resource1 ... ]
CS:
type='unavailable'>
[ ... to resource2 ... ]
CS:
type='unavailable'>
Implementation Note: If the contact's server does not broadcast
subsequent presence notifications to users who are offline (as
described under
Section 4.4.2
), it MUST also update its internal
representation of which entities are online by noting that the
user is unavailable.
Saint-Andre Standards Track [Page 61]
RFC 6121
XMPP IM March 2011
4.5.4
. Client Processing of Unavailable Presence
From the perspective of the contact's client, there is no significant
difference between available presence broadcast and unavailable
presence broadcast, so in general the contact's client follows the
rules for processing of inbound presence defined under
Section 4.4.3
However, if the contact receives an unavailable notification from the
bare JID of the user (rather than the full JID of a particular
available resource), the contact's client SHOULD treat the
unavailable notification as applying to all resources.
4.6
. Directed Presence
This section supplements the rules for client and server processing
of presence notifications and presence probes, but only for the
special case of directed presence.
4.6.1
. General Considerations
In general, a client sends directed presence when it wishes to share
availability information with an entity that is not subscribed to its
presence, typically on a temporary basis. Common uses of directed
presence include casual one-to-one chat sessions as described under
Section 5.1
and multi-user chat rooms as described in [
XEP-0045
].
The temporary relationship established by sharing directed presence
with another entity is secondary to the permanent relationship
established through a presence subscription. Therefore, the acts of
creating, modifying, or canceling a presence subscription MUST take
precedence over the rules specified in the following subsections.
For example, if a user shares directed presence with a contact but
then adds the contact to the user's roster by completing the presence
subscription "handshake", the user's server MUST treat the contact
just as it would any normal subscriber as described under
Section 3
for example, by sending subsequent presence broadcasts to the
contact. As another example, if the user then cancels the contact's
subscription to the user's presence, the user's server MUST handle
the cancellation just as it normally would as described under
Section 3.2
, which includes sending unavailable presence to the
contact even if the user has sent directed presence to the contact.
XMPP servers typically implement directed presence by keeping a list
of the entities (bare JIDs or full JIDs) to which a user has sent
directed presence during the user's current session for a given
resource (full JID), then clearing the list when the user goes
offline (e.g., by sending a broadcast presence stanza of type
"unavailable"). The server MUST remove from the directed presence
Saint-Andre Standards Track [Page 62]
RFC 6121
XMPP IM March 2011
list (or its functional equivalent) any entity to which the user
sends directed unavailable presence and SHOULD remove any entity that
sends unavailable presence to the user.
4.6.2
. Client Generation of Directed Presence
As noted, directed presence is a client-generated presence stanza
with a 'to' attribute whose value is the bare JID or full JID of the
other entity and with either no 'type' attribute (indicating
availability) or a 'type' attribute whose value is "unavailable".
4.6.3
. Server Processing of Outbound Directed Presence
When the user's server receives a directed presence stanza, it SHOULD
process it according to the following rules.
1. If the user sends directed available or unavailable presence to a
contact that is in the user's roster with a subscription type of
"from" or "both" after having sent initial presence and before
sending unavailable presence broadcast (i.e., during the user's
presence session), the user's server MUST locally deliver or
remotely route the full XML of that presence stanza but SHOULD
NOT otherwise modify the contact's status regarding presence
broadcast (i.e., it SHOULD include the contact's JID in any
subsequent presence broadcasts initiated by the user).
2. If the user sends directed presence to an entity that is not in
the user's roster with a subscription type of "from" or "both"
after having sent initial presence and before sending unavailable
presence broadcast (i.e., during the user's presence session),
the user's server MUST locally deliver or remotely route the full
XML of that presence stanza to the entity but MUST NOT modify the
contact's status regarding available presence broadcast (i.e., it
MUST NOT include the entity's JID in any subsequent broadcasts of
available presence initiated by the user); however, if the
available resource from which the user sent the directed presence
becomes unavailable, the user's server MUST route that
unavailable presence to the entity (if the user has not yet sent
directed unavailable presence to that entity).
3. If the user sends directed presence without first sending initial
presence or after having sent unavailable presence broadcast
(i.e., the resource is connected but not available), the user's
server MUST treat the entity to which the user sends directed
presence as in case #2 above.
Saint-Andre Standards Track [Page 63]
RFC 6121
XMPP IM March 2011
4.6.4
. Server Processing of Inbound Directed Presence
From the perspective of the contact's server, there is no significant
difference between presence broadcast and directed presence, so the
contact's server follows the rules for processing of inbound presence
defined under Sections
4.3.2
4.4.3
, and
4.5.3
4.6.5
. Client Processing of Inbound Directed Presence
From the perspective of the contact's client, there is no significant
difference between presence broadcast and directed presence, so the
contact's client follows the rules for processing of inbound presence
defined under
Section 4.4.3
4.6.6
. Server Processing of Presence Probes
If a user's client has sent directed presence to another entity
(e.g., a one-to-one chat partner or a multi-user chat room), after
some time the entity or its server might want to know if the client
is still online. This scenario is especially common in the case of
multi-user chat rooms, in which the user might be a participant for a
long period of time. If the user's client goes offline without the
chat room being informed (either by the client or the client's
server), the user's representation in the room might become a "ghost"
that appears to be participating but that in fact is no longer
present in the room. To detect such "ghosts", some multi-user chat
room implementations send presence probes to users that have joined
the room.
In the case of directed presence, the probing entity SHOULD send the
probe from the JID that received directed presence (whether a full
JID or a bare JID). The probe SHOULD be sent to the user's full JID,
not the user's bare JID without a resourcepart, because the temporary
"authorization" involved with directed presence is based on the full
JID from which the user sent directed presence to the probing entity.
When the user's server receives a probe, it MUST first apply any
logic associated with presence subscriptions as described under
Section 4.3.2
. If the probing entity does not have a subscription to
the user's presence, then the server MUST check if the user has sent
directed presence to the entity during its current session; if so,
the server SHOULD answer the probe with only mere presence of type
"available" or "unavailable" (i.e., not including child elements) and
only for that full JID (i.e., not for any other resources that might
be currently associated with the user's bare JID).
Saint-Andre Standards Track [Page 64]
RFC 6121
XMPP IM March 2011
4.7
. Presence Syntax
4.7.1
. Type Attribute
The absence of a 'type' attribute signals that the relevant entity is
available for communication (see
Section 4.2
and
Section 4.4
).
A 'type' attribute with a value of "unavailable" signals that the
relevant entity is not available for communication (see
Section 4.5
).
The XMPP presence stanza is also used to negotiate and manage
subscriptions to the presence of other entities. These tasks are
completed via presence stanzas of type "subscribe", "unsubscribe",
"subscribed", and "unsubscribed" as described under
Section 3
If a user and contact are associated with different XMPP servers,
those servers also use a special presence stanza of type "probe" in
order to determine the availability of the entity on the peer server;
details are provided under
Section 4.3
. Clients SHOULD NOT send
presence stanzas of type "probe".
The values of the 'type' attribute can be summarized as follows:
o error -- An error has occurred regarding processing of a
previously sent presence stanza; if the presence stanza is of type
"error", it MUST include an
XMPP-CORE
]).
o probe -- A request for an entity's current presence; SHOULD be
generated only by a server on behalf of a user.
o subscribe -- The sender wishes to subscribe to the recipient's
presence.
o subscribed -- The sender has allowed the recipient to receive
their presence.
o unavailable -- The sender is no longer available for
communication.
o unsubscribe -- The sender is unsubscribing from the receiver's
presence.
o unsubscribed -- The subscription request has been denied or a
previously granted subscription has been canceled.
Saint-Andre Standards Track [Page 65]
RFC 6121
XMPP IM March 2011
If the value of the 'type' attribute is not one of the foregoing
values, the recipient or an intermediate router SHOULD return a
stanza error of
Implementation Note: There is no default value for the 'type'
attribute of the
Implementation Note: There is no value of "available" for the
'type' attribute of the
4.7.2
. Child Elements
In accordance with the default namespace declaration, a presence
stanza is qualified by the 'jabber:client' or 'jabber:server'
namespace, which defines certain child elements of presence stanzas,
in particular the
These child elements are used to provide more detailed information
about an entity's availability. Typically these child elements are
included only if the presence stanza possesses no 'type' attribute,
although exceptions are noted in the text that follows.
4.7.2.1
. Show Element
The OPTIONAL
sub-state of an entity or a specific resource thereof. A presence
stanza MUST NOT contain more than one
attributes defined for the
NOT contain mixed content (as defined in Section 3.2.2 of [
XML
]).
The XML character data of the
presentation to a human user. The XML character data MUST be one of
the following (additional availability states could be defined
through extended content elements):
o away -- The entity or resource is temporarily away.
o chat -- The entity or resource is actively interested in chatting.
o dnd -- The entity or resource is busy (dnd = "Do Not Disturb").
o xa -- The entity or resource is away for an extended period (xa =
"eXtended Away").
If no
and available.
Any specialized processing of availability states by recipients and
intermediate routers is up to the implementation (e.g., incorporation
of availability states into stanza routing and delivery logic).
Saint-Andre Standards Track [Page 66]
RFC 6121
XMPP IM March 2011
4.7.2.2
. Status Element
The OPTIONAL
data specifying a natural-language description of an entity's
availability. It is normally used in conjunction with the show
element to provide a detailed description of an availability state
(e.g., "In a meeting") when the presence stanza has no 'type'
attribute.
There are no attributes defined for the
exception of the 'xml:lang' attribute inherited from [
XML
]. The
Section 3.2.2 of [
XML
]). Multiple instances of the
MAY be included, but only if each instance possesses an 'xml:lang'
attribute with a distinct language value (either explicitly or by
inheritance from the 'xml:lang' value of an element farther up in the
XML hierarchy, which from the sender's perspective can include the
XML stream header as described in [
XMPP-CORE
]).
xml:lang='en'>
A presence stanza of type "unavailable" MAY also include a
element to provide detailed information about why the entity is going
offline.
type='unavailable'
xml:lang='en'>
Saint-Andre Standards Track [Page 67]
RFC 6121
XMPP IM March 2011
The
presence stanza (i.e., type "subscribe", "subscribed", "unsubscribe",
or "unsubscribed") to provide a description of the action. An
interactive client MAY present this
user (see
Section 11
).
to='nurse@example.com'
type='subscribe'>
4.7.2.3
. Priority Element
The OPTIONAL
character data that specifies the priority level of the resource.
The value MUST be an integer between -128 and +127. A presence
stanza MUST NOT contain more than one
no attributes defined for the
element MUST NOT contain mixed content (as defined in Section 3.2.2
of [
XML
]).
If no priority is provided, the processing server or client MUST
consider the priority to be zero ("0").
The client's server MAY override the priority value provided by the
client (e.g., in order to impose a message handling rule of
delivering a message intended for the account's bare JID to all of
the account's available resources). If the server does so, it MUST
communicate the modified priority value when it echoes the client's
presence back to itself and sends the presence notification to the
user's contacts (because this modified priority value is typically
the default value of zero, communicating the modified priority value
can be done by not including the
For information regarding the semantics of priority values in stanza
processing within instant messaging and presence applications, refer
to
Section 8
Saint-Andre Standards Track [Page 68]
RFC 6121
XMPP IM March 2011
4.7.3
. Extended Content
As described in [
XMPP-CORE
], an XML stanza MAY contain any child
element that is qualified by a namespace other than the default
namespace; this applies to the presence stanza as well.
(In the following example, the presence stanza includes entity
capabilities information as defined in [
XEP-0115
].)
node='http://psi-im.org'
ver='q07IKJEyjvHSyhy//CH0CxmKi8w='/>
Any extended content included in a presence stanza SHOULD represent
aspects of an entity's availability for communication or provide
information about communication-related capabilities.
. Exchanging Messages
Once a client has authenticated with a server and bound a resource to
an XML stream as described in [
XMPP-CORE
], an XMPP server will route
XML stanzas to and from that client. One kind of stanza that can be
exchanged is
enabled on the server). Exchanging messages is a basic use of XMPP
and occurs when a user generates a message stanza that is addressed
to another entity. As defined under
Section 8
, the sender's server
is responsible for delivering the message to the intended recipient
(if the recipient is on the same local server) or for routing the
message to the recipient's server (if the recipient is on a remote
server). Thus a message stanza is used to "push" information to
another entity.
5.1
. One-to-One Chat Sessions
In practice, instant messaging activity between human users tends to
occur in the form of a conversational burst that we call a "chat
session": the exchange of multiple messages between two parties in
relatively rapid succession within a relatively brief period of time.
When a human user intends to engage in such a chat session with a
contact (rather than sending a single message to which no reply is
expected), the message type generated by the user's client SHOULD be
"chat" and the contact's client SHOULD preserve that message type in
subsequent replies. The user's client also SHOULD include a
Saint-Andre Standards Track [Page 69]
RFC 6121
XMPP IM March 2011
client SHOULD also preserve during the life of the chat session (see
Section 5.2.5
).
The user's client SHOULD address the initial message in a chat
session to the bare JID
than attempting to guess an appropriate full JID
received from the contact). Until and unless the user's client
receives a reply from the contact, it SHOULD send any further
messages to the contact's bare JID. The contact's client SHOULD
address its replies to the user's full JID
the initial message. Once the user's client receives a reply from
the contact's full JID, it SHOULD address its subsequent messages to
the contact's full JID as provided in the 'from' address of the
contact's replies, thus "locking in" on that full JID. A client
SHOULD "unlock" after having received a
stanza from any other resource controlled by the peer (or a presence
stanza from the locked resource); as a result, it SHOULD address its
next message(s) in the chat session to the bare JID of the peer (thus
"unlocking" the previous "lock") until it receives a message from one
of the peer's full JIDs.
When two parties engage in a chat session but do not share presence
with each other based on a presence subscription, they SHOULD send
directed presence to each other so that either party can easily
discover if the peer goes offline during the course of the chat
session. However, a client MUST provide a way for a user to disable
such presence sharing globally or to enable it only with particular
entities. Furthermore, a party SHOULD send directed unavailable
presence to the peer when it has reason to believe that the chat
session is over (e.g., if, after some reasonable amount of time, no
subsequent messages have been exchanged between the parties).
An example of a chat session is provided under
Section 7
5.2
. Message Syntax
The following sections describe the syntax of the
5.2.1
. To Attribute
An instant messaging client specifies an intended recipient for a
message by providing the JID of the intended recipient in the 'to'
attribute of the
Saint-Andre Standards Track [Page 70]
RFC 6121
XMPP IM March 2011
If the message is being sent outside the context of any existing chat
session or received message, the value of the 'to' address SHOULD be
of the form
Section 5.1
).
id='ktx72v49'
to='romeo@example.net'
type='chat'
xml:lang='en'>
Art thou not Romeo, and a Montague?
If the message is being sent in reply to a message previously
received from an address of the form
one-to-one chat session as described under
Section 5.1
), the value of
the 'to' address SHOULD be of the form
presence) that the intended recipient's resource is no longer
available.
id='sl3nx51f'
to='juliet@example.com/balcony'
type='chat'
xml:lang='en'>
Neither, fair saint, if either thee dislike.
5.2.2
. Type Attribute
Common uses of the message stanza in instant messaging applications
include: single messages; messages sent in the context of a one-to-
one chat session; messages sent in the context of a multi-user chat
room; alerts, notifications, or other information to which no reply
is expected; and errors. These uses are differentiated via the
'type' attribute. Inclusion of the 'type' attribute is RECOMMENDED.
If included, the 'type' attribute MUST have one of the following
values:
Saint-Andre Standards Track [Page 71]
RFC 6121
XMPP IM March 2011
o chat -- The message is sent in the context of a one-to-one chat
session. Typically an interactive client will present a message
of type "chat" in an interface that enables one-to-one chat
between the two parties, including an appropriate conversation
history. Detailed recommendations regarding one-to-one chat
sessions are provided under
Section 5.1
o error -- The message is generated by an entity that experiences an
error when processing a message received from another entity (for
details regarding stanza error syntax, refer to [
XMPP-CORE
]). A
client that receives a message of type "error" SHOULD present an
appropriate interface informing the original sender regarding the
nature of the error.
o groupchat -- The message is sent in the context of a multi-user
chat environment (similar to that of [
IRC
]). Typically a
receiving client will present a message of type "groupchat" in an
interface that enables many-to-many chat between the parties,
including a roster of parties in the chatroom and an appropriate
conversation history. For detailed information about XMPP-based
groupchat, refer to [
XEP-0045
].
o headline -- The message provides an alert, a notification, or
other transient information to which no reply is expected (e.g.,
news headlines, sports updates, near-real-time market data, or
syndicated content). Because no reply to the message is expected,
typically a receiving client will present a message of type
"headline" in an interface that appropriately differentiates the
message from standalone messages, chat messages, and groupchat
messages (e.g., by not providing the recipient with the ability to
reply). If the 'to' address is the bare JID, the receiving server
SHOULD deliver the message to all of the recipient's available
resources with non-negative presence priority and MUST deliver the
message to at least one of those resources; if the 'to' address is
a full JID and there is a matching resource, the server MUST
deliver the message to that resource; otherwise the server MUST
either silently ignore the message or return an error (see
Section 8
).
o normal -- The message is a standalone message that is sent outside
the context of a one-to-one conversation or groupchat, and to
which it is expected that the recipient will reply. Typically a
receiving client will present a message of type "normal" in an
interface that enables the recipient to reply, but without a
conversation history. The default value of the 'type' attribute
is "normal".
Saint-Andre Standards Track [Page 72]
RFC 6121
XMPP IM March 2011
An IM application SHOULD support all of the foregoing message types.
If an application receives a message with no 'type' attribute or the
application does not understand the value of the 'type' attribute
provided, it MUST consider the message to be of type "normal" (i.e.,
"normal" is the default).
Guidelines for server handling of different message types is provided
under
Section 8
Although the 'type' attribute is OPTIONAL, it is considered polite to
mirror the type in any replies to a message; furthermore, some
specialized applications (e.g., a multi-user chat service) MAY at
their discretion enforce the use of a particular message type (e.g.,
type='groupchat').
5.2.3
. Body Element
The