XEP-0199: XMPP Ping

This document defines an XMPP protocol extension for sending pings over XML streams.


NOTICE: This document is currently within Last Call or under consideration by the XMPP Council for advancement to the next stage in the XSF standards process.


Document Information

Series: XEP
Number: 0199
Publisher: XMPP Standards Foundation
Status: Proposed
Type: Standards Track
Version: 0.3
Last Updated: 2007-05-07
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: TO BE ASSIGNED
Wiki Page: <http://wiki.jabber.org/index.php/XMPP Ping (XEP-0199)>

Author Information

Peter Saint-Andre

Email: stpeter@jabber.org
JabberID: stpeter@jabber.org

Legal Notice

This XMPP Extension Protocol is copyright 1999 - 2007 by the XMPP Standards Foundation (XSF) and is in full conformance with the XSF's Intellectual Property Rights Policy <http://www.xmpp.org/extensions/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) 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.

Conformance Terms

The following 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".


Table of Contents


1. Introduction
2. Requirements
3. Protocol
4. Use Cases
    4.1. Server-To-Client Pings
    4.2. Client-To-Server Pings
    4.3. Server-To-Server Pings
    4.4. Client-to-Client Pings
    4.5. Component-to-Client Pings
5. Discovering Support
6. Security Considerations
7. IANA Considerations
8. XMPP Registrar Considerations
    8.1. Protocol Namespaces
9. XML Schema
Notes
Revision History


1. Introduction

As specified in RFC 3920 [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 also be used with other bindings such as the BOSH [2] method for which XMPP Over BOSH [3] is the XMPP profile.

2. Requirements

This specification addresses the following requirements:

  1. Determining the viability of an XML stream (i.e., its underlying binding) between a client and a server, or between two servers.
  2. Determining end-to-end connectivity between any two XMPP entities (e.g., two clients).

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.

3. Protocol

The XMPP ping protocol is extremely simple:

  1. The pinging entity sends an IQ-get containing a <ping/> element qualified by the 'http://www.xmpp.org/extensions/xep-0199.html#ns' namespace (see Protocol Namespaces regarding issuance of one or more permanent namespaces).
  2. The pinged entity returns either an IQ-result (if it supports the namespace) or an IQ-error (if it does not). (See the Security Considerations regarding leaks of presence information in the context of pings sent to clients.)

4. Use Cases

4.1 Server-To-Client Pings

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.

Example 1. Ping

<iq from='capulet.lit' to='juliet@capulet.lit/balcony' id='s2c1' type='get'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
</iq>
    

If the client supports the ping namespace, it MUST return an IQ result:

Example 2. Pong

<iq from='juliet@capulet.lit/balcony' to='capulet.lit' id='s2c1' type='result'/>
    

If the client does not support the ping namespace, it MUST return an IQ error, which SHOULD be <service-unavailable/>:

Example 3. Ping Not Supported

<iq from='juliet@capulet.lit/balcony' to='capulet.lit' id='s2c1' type='error'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
  <error type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

The other error conditions defined in RFC 3920 could also be returned if appropriate.

4.2 Client-To-Server Pings

A client may also ping its server by sending an <iq/> get over the stream between the two entities.

Example 4. Ping

<iq from='juliet@capulet.lit/balcony' to='capulet.lit' id='c2s1' type='get'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
</iq>
    

Note: The client MAY include a 'to' address of the client's bare JID (<node@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:

Example 5. Pong

<iq from='capulet.lit' to='juliet@capulet.lit/balcony' id='c2s1' type='result'/>
    

If the server does not support the ping namespace, it MUST return an IQ error, which SHOULD be <service-unavailable/>:

Example 6. Ping Not Supported

<iq from='capulet.lit' to='juliet@capulet.lit/balcony' id='c2s1' type='error'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
  <error type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

The other error conditions defined in RFC 3920 could also be returned if appropriate.

4.3 Server-To-Server Pings

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.

Example 7. Ping

<iq from='capulet.lit' to='montague.lit' id='s2s1' type='get'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
</iq>
    

If the other party to the stream supports the ping namespace, it MUST return an IQ result:

Example 8. Pong

<iq from='montague.lit' to='capulet.lit' id='s2s1' type='result'/>
    

If the other party to the stream does not support the ping namespace, it MUST return an IQ error, which SHOULD be <service-unavailable/>:

Example 9. Ping Not Supported

<iq from='montague.lit' to='capulet.lit' id='s2s1' type='error'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
  <error type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

The other error conditions defined in RFC 3920 could also be returned if appropriate.

4.4 Client-to-Client Pings

Pings can also be used for client-to-client (i.e., end-to-end) pings.

Example 10. Ping

<iq from='romeo@montague.lit/home' 
    to='juliet@capulet.lit/chamber'
    type='get' 
    id='e2e1'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
</iq>
    

If the pinged entity supports the ping namespace, it SHOULD return an IQ result:

Example 11. Pong

<iq from='juliet@capulet.lit/chamber'
    to='romeo@montague.lit/home' 
    id='e2e1'
    type='result'/>
    

If the pinged entity does not support the ping namespace, it SHOULD return an IQ error, which SHOULD be <service-unavailable/>:

Example 12. Ping Not Supported

<iq from='juliet@capulet.lit/chamber'
    to='romeo@montague.lit/home' 
    id='e2e1'
    type='result'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
  <error type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

The other error conditions defined in RFC 3920 could also be returned if appropriate.

4.5 Component-to-Client Pings

Pings can also be used for component-to-client pings, for example from a Multi-User Chat [5] component to a client.

Example 13. Ping

<iq from='chat.shakespeare.lit'
    to='juliet@capulet.lit/chamber'
    type='get' 
    id='comp1'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
</iq>
    

If the pinged entity supports the ping namespace, it SHOULD return an IQ result:

Example 14. Pong

<iq from='juliet@capulet.lit/chamber'
    to='chat.shakespeare.lit'
    id='comp1'
    type='result'/>
    

If the pinged entity does not support the ping namespace, it SHOULD return an IQ error, which SHOULD be <service-unavailable/>:

Example 15. Ping Not Supported

<iq from='juliet@capulet.lit/chamber'
    to='chat.shakespeare.lit'
    id='comp1'
    type='error'>
  <ping xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
  <error type='cancel'>
    <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>
    

The other error conditions defined in RFC 3920 could also be returned if appropriate.

5. Discovering Support

If an entity supports the XMPP Ping protocol, it MUST report that by including a service discovery feature of "http://www.xmpp.org/extensions/xep-0199.html#ns" (see Protocol Namespaces regarding issuance of one or more permanent namespaces) in response to a Service Discovery [6] information request:

Example 16. Service Discovery information request

<iq type='get'
    from='juliet@capulet.lit/balcony'
    from='capulet.lit'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
  

Example 17. Service Discovery information response

<iq type='result'
    from='capulet.lit'
    to='juliet@capulet.lit/balcony'
    id='disco1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='http://www.xmpp.org/extensions/xep-0199.html#ns'/>
    ...
  </query>
</iq>
  

6. Security Considerations

A pinged entity MAY ignore the IQ (i.e., return neither a result nor an error) if doing so would reveal its presence (network availability) information to an entity that is not authorized to view that information; this mainly applies to pings sent to clients (where the response would reveal client availability) but may apply to other entities as well.

7. IANA Considerations

No interaction with the Internet Assigned Numbers Authority (IANA) [7] is necessary as a result of this document.

8. XMPP Registrar Considerations

8.1 Protocol Namespaces

Until this specification advances to a status of Draft, its associated namespace shall be "http://www.xmpp.org/extensions/xep-0199.html#ns"; upon advancement of this specification, the XMPP Registrar [8] shall issue a permanent namespace in accordance with the process defined in Section 4 of XMPP Registrar Function [9].

9. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://www.xmpp.org/extensions/xep-0199.html#ns'
    xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'
    elementFormDefault='qualified'>

  <xs:element name='ping' type='empty'/>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
  

Notes

1. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc3920>.

2. XEP-0124: Bidirectional-streams Over Synchronous HTTP <http://www.xmpp.org/extensions/xep-0124.html>.

3. XEP-0206: XMPP Over BOSH <http://www.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 <http://www.xmpp.org/extensions/xep-0045.html>.

6. XEP-0030: Service Discovery <http://www.xmpp.org/extensions/xep-0030.html>.

7. 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/>.

8. 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 <http://www.xmpp.org/registrar/>.

9. XEP-0053: XMPP Registrar Function <http://www.xmpp.org/extensions/xep-0053.html>.


Revision History

Version 0.3 (2007-05-07)

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.

(psa)

Version 0.2 (2006-11-22)

Changed IQ-set to IQ-get; clarified requirements; specified protocol description; added use cases.

(psa)

Version 0.1 (2006-11-21)

Initial version.

(psa)

END