As specified in XMPP Core [1], the XML streams used in XMPP are bound to TCP. Unfortunately, TCP connections can go down without the application (XMPP) layer knowing about it. The traditional approach to solving this issue has been to periodically send so-called "whitespace pings" over the XML stream. This document recommends a more XML-friendly approach, which can be used over more than one hop in the communication path (e.g., from one client to another) and can also be used with other bindings such as the BOSH (XEP-0124) [2] method for which XMPP Over BOSH (XEP-0206) [3] is the XMPP profile.
This specification addresses the following requirements:
The number of "hops" for which the ping tests connectivity depends on how far the pinged entity is from the pinging entity, as shown in the following use cases. However, this specification does not provide per-hop information similar to that provided by the traceroute protocol (RFC 1393 [4]); a future specification may define such functionality for XMPP.
The XMPP ping protocol is extremely simple:
One popular usage is for a server to test the viability of the underlying stream connection by pinging a connected client. This is done by sending an <iq/> get over the stream from the server to the client.
If the client supports the ping namespace, it MUST return an IQ-result, which functions as a "pong":
If the client does not support the ping namespace, it MUST return a <service-unavailable/> error:
The other error conditions defined in RFC 6120 [1] could also be returned if appropriate.
A client may also ping its server by sending an IQ-get over the stream between the two entities.
Note: The client MAY include a 'to' address of the client's bare JID <localpart@domain.tld>, in this instance "juliet@capulet.lit" or MAY include no 'to' address (this signifies that the stanza shall be handled by the server on behalf of the connected user's bare JID, which in the case of <iq/> stanzas is equivalent to directing the IQ-get to the server itself).
If the server supports the ping namespace, it MUST return an IQ-result:
If the server does not support the ping namespace, it MUST return a <service-unavailable/> error:
The other error conditions defined in RFC 6120 [1] could also be returned if appropriate.
Pings can also be used to test a server-to-server connection. This is done by sending an IQ-get over the stream from one server to another.
If the other party to the stream supports the ping namespace, it MUST return an IQ-result:
If the other party to the stream does not support the ping namespace, it MUST return a <service-unavailable/> error:
The other error conditions defined in RFC 6120 [1] could also be returned if appropriate.
Pings can also be used for client-to-client (i.e., end-to-end) pings.
Note: The 'to' address should be a full JID <localpart@domain.tld/resource>, since a ping sent to a bare JID <localpart@domain.tld> will be handled by the server on behalf of the client.
If the pinged entity supports the ping namespace, it SHOULD return an IQ-result:
If the pinged entity does not support the ping namespace, it MUST return a <service-unavailable/> error:
The other error conditions defined in RFC 6120 [1] could also be returned if appropriate.
Pings can also be used for component-to-client pings, for example from a Multi-User Chat (XEP-0045) [5] component to a client.
Note: The 'to' address should be a full JID <localpart@domain.tld/resource>, since a ping sent to a bare JID <localpart@domain.tld> will be handled by the server on behalf of the client.
If the pinged entity supports the ping namespace, it SHOULD return an IQ-result:
If the pinged entity does not support the ping namespace, RFC 6120 [1] requires it to return a <service-unavailable/> error:
The other error conditions defined in RFC 6120 [1] could also be returned if appropriate.
If an entity supports the XMPP Ping protocol, it MUST report that fact by including a service discovery feature of "urn:xmpp:ping" in response to a Service Discovery (XEP-0030) [6] information request:
In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in Entity Capabilities (XEP-0115) [7]. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.
Some XMPP clients do not respond to IQ stanzas containing unsupported payloads. Although this is in violation of XMPP Core [1], this behavior can result in disconnection of clients that are in fact actively connected to the server.
If a server receives a ping request directed to a full JID <localpart@domain.tld/resource> associated with a registered account but there is no connected resource matching the 'to' address, RFC 6120 [1] requires it to reply with a <service-unavailable/> error and set the 'from' address of the IQ-error to the full JID provided in the 'to' address of the ping request. If a connected resource receives a ping request but it does not want to reveal its network availability to the sender for any reason (e.g., because the sender is not authorized to know the connected resource's availability), then it too MUST reply with a <service-unavailable/> error. This consistency between the server response and the client response helps to prevent presence leaks.
No interaction with the Internet Assigned Numbers Authority (IANA) [8] is necessary as a result of this document.
The XMPP Registrar [9] includes "urn:xmpp:ping" in its registry of protocol namespaces (see <https://xmpp.org/registrar/namespaces.html>).
This document in other formats: XML PDF
This XMPP Extension Protocol is copyright © 1999 – 2024 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 HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.
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 <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.
Errata can be sent to <editor@xmpp.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".
1. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.
2. XEP-0124: Bidirectional-streams Over Synchronous HTTP <https://xmpp.org/extensions/xep-0124.html>.
3. XEP-0206: XMPP Over BOSH <https://xmpp.org/extensions/xep-0206.html>.
4. RFC 1393: Traceroute Using an IP Option <http://tools.ietf.org/html/rfc1393>.
5. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.
6. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.
7. XEP-0115: Entity Capabilities <https://xmpp.org/extensions/xep-0115.html>.
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 https://xmpp.org/extensions/attic/
Per a vote of the XMPP Council, advanced status to Final.
Per a vote of the XMPP Council, advanced status to Draft; XMPP Registrar issued urn:xmpp:ping namespace.
Clarified error handling and recommended against sending to bare JIDs.
Modified security considerations to ensure coherence of error handling between client and server.
Added use case for client pinging server; changed namespace to conform to XMPP Registrar requirements, with namespace to be issued upon advancement to Draft; added section on discovering support.
Changed IQ-set to IQ-get; clarified requirements; specified protocol description; added use cases.
Initial version.
@report{saint-andre2006ping, title = {XMPP Ping}, author = {Saint-Andre, Peter}, type = {XEP}, number = {0199}, version = {2.0.1}, institution = {XMPP Standards Foundation}, url = {https://xmpp.org/extensions/xep-0199.html}, date = {2006-11-21/2019-03-26}, }
END