Some XMPP-based instant messaging systems have long supported the ability for users to be online but to appear offline to other users. This "invisibility" feature was previously defined in nonstandard or complicated ways via Invisible Presence (XEP-0018)  and Invisibility (XEP-0126)  (the latter was a profile of Privacy Lists (XEP-0016) , which is now deprected). By contrast, this specification defines a standards-compliant protocol extension that can be used over the long term, using an IQ-based protocol that enables an IM user to become "invisible" and "visible" at will within the context of a given session.
The requirements for invisible mode are straightforward:
In order for a client to go invisible, it sends an IQ-set with no 'to' address (thus handled by the user's server) containing an <invisible/> element qualified by the 'urn:xmpp:invisible:1' namespace (see Namespace Versioning regarding the possibility of incrementing the version number).
The <invisible/> element SHOULD include a 'probe' attribute, which specifies whether the server shall or shall not send presence probes to entities in the user's roster (thus determining whether the user does or does not automatically receive presence notifications from contacts). This attribute is a boolean , where a logical value of TRUE (lexical value of "true" or "1") indicates that the server shall send presence probes and where a logical value of FALSE (lexical value of "false" or "0") indicates that the server shall not send presence probes. The default logical value is FALSE.
Although the default value is false (thus protecting the user from leaking presence information), the client SHOULD always include the 'probe' attribute.
If the server can successfully process the invisible command, it MUST return an IQ-result.
(Standard XMPP stanza errors apply; see RFC 6120.)
When the client enters invisible mode during a presence session (i.e., after having previously sent undirected available presence with no 'type' attribute), the server MUST send <presence type='unavailable'/> from the specified resource to all contacts who would receive unavailable presence if the client itself were to send <presence type='unavailable'/>.
The following sections define server and client handling of inbound and outbound XML stanzas while the client is invisible.
While the client is in invisible mode, the server:
MUST NOT broadcast outbound presence notifications as a result of receiving any subsequent undirected presence notifications from the client.
MUST deliver outbound directed presence stanzas generated by the client.
MUST generate or not generate outbound presence probes in accordance with the value of the 'probe' attribute.
MUST deliver inbound <presence/> stanzas.
SHOULD deliver inbound <message/> stanzas whose 'to' address is the bare JID <email@example.com> of the user (subject to standard XMPP stanza handling rules from RFC 6120 and RFC 6121).
MUST deliver inbound <message/> and <iq/> stanzas whose 'to' address is the full JID <firstname.lastname@example.org/resource> corresponding to the resource of the client.
MUST deliver outbound <message/> and <iq/> stanzas generated by the client (for an important note regarding presence leaks, see the Security Considerations section of this document).
If there are no other available resources, MUST respond to all IQ-get requests and presence probes sent to the account's bare JID as if the account were offline; this includes but is not limited to the following:
If after sending directed presence the client then sends <presence type='unavailable'/>, the server MUST deliver that unavailable presence only to the entities to which the client sent directed presence after going invisible.
While the client is in invisible mode, it is suggested that the client behave as follows:
Maintain a temporary list of entities with which communication is allowed and prompt the user before adding any entity to that "communicants list" for this invisibility session; for user convenience, this list might be auto-populated with trusted entities if so configured by the user.
Prompt the user before sending any outbound traffic (message, presence, or IQ stanza) to another user, even if the user generated such traffic; upon receiving authorization from the user, the client might then add the authorized entity to the communicants list for this invisibility session.
In order for a client to become visible again, it sends an IQ-set with no 'to' address (thus handled by the user's server) containing a <visible/> element qualified by the 'urn:xmpp:invisible:1' namespace (see Namespace Versioning regarding the possibility of incrementing the version number).
If the server can successfully process the visibility command, it MUST return an IQ-result.
When the client becomes visible, the server MUST treat that state as equivalent to an active session before receiving initial presence from the client, with one exception: if the client sent directed presence to any entities while in the invisible state, the server MUST treat those entities as under point 2 of Section 4.6.3 of RFC 6121 (i.e., the server MUST ensure that it sends unavailable presence to those entities if the client subsequently goes offline after becoming visible).
If the user wishes to then send presence to all contacts in the roster, it is the responsibility of the client to send an undirected available presence notification to the server.
The server would then broadcast that presence notification to all entities who would normally receive presence broadcasts from the client (the server MAY also send that notification to any entities to which the client sent directed presence while invisible, whether or not they are in the user's roster).
In order for a client to discover whether its server supports the invisible command, it sends a Service Discovery (XEP-0030)  information request to the server:
If the server supports the invisible command, it MUST return a feature of "urn:xmpp:invisible:1" (see Namespace Versioning regarding the possibility of incrementing the version number).
A client SHOULD complete this service discovery process before sending initial presence to its server (as specified in Entity Capabilities (XEP-0115) , a server can include entity capabilities information in a stream feature, which obviates the need for explicit service discovery as shown above).
Implementers need to be aware that use of the 'probe' attribute is not consistent with the older privacy lists approach defined in XEP-0126.
No matter how it is implemented, invisibility can be defeated and presence leaks can occur without careful stanza handling on the part of the server and the client. Use of the protocol defined here does not necessarily prevent presence leaks, either technically or socially (e.g., if the user reveals his presence to one contact but not another and those contacts are in communication).
No interaction with the Internet Assigned Numbers Authority (IANA)  is required as a result of this document.
This specification defines the following XML namespace:
Upon advancement of this specification from a status of Experimental to a status of Draft, the XMPP Registrar  shall add the foregoing namespace to the registry located at <https://xmpp.org/registrar/namespaces.html>, as described in Section 4 of XMPP Registrar Function (XEP-0053) .
If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of XEP-0053.
Thanks to Philipp Hancke, Evgeny Khramtsov, Ruslan Marchenko, Kevin Smith, and Matthew Wild for their feedback.
This document in other formats: XML PDF
This XMPP Extension Protocol is copyright © 1999 – 2018 by the XMPP Standards Foundation (XSF).
Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.
## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.
This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <email@example.com> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <firstname.lastname@example.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
4. In accordance with Section 220.127.116.11 of XML Schema Part 2: Datatypes, the allowable lexical representations for the xs:boolean datatype are the strings "0" and "false" for the concept 'false' and the strings "1" and "true" for the concept 'true'; implementations MUST support both styles of lexical representation.
8. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
9. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Addressed Last Call feedback: (1) clarified conformance requirements for 'probe' attribute and (2) removed text about using the same server backend for privacy lists because XEP-0016 is now deprecated.
Added method for specifying server behavior regarding presence probes via new 'probe' attribute; incremented the protocol version number from 0 to 1.
Clarified handling of directed presence while in invisible state.
Further clarified server and client handling of stanzas during an invisibility session; updated RFC references.
Further clarified server and client handling of stanzas during an invisibility session.
Modified namespace to incorporate namespace versioning.
Added note about integration with privacy lists; removed XEP-0126 from list of protocols that this specification supersedes; changed temporary namespace to conform to XMPP Registrar procedures; copied several security considerations from XEP-0126.
Clarified that this specification is intended to supersede XEP-0018 and XEP-0126; added several additional examples.
Modified XML namespace name to conform to XEP-0053 processes.
Added XMPP Registrar considerations and XML schema.
Added inbound presence rule to server handling section.
Clarified that invisibility mode does not carry across sessions.
Recommended delivery of messages sent to bare JID.