2006-11-21 18:21:12 -05:00
<?xml version='1.0' encoding='UTF-8'?>
< !DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep >
<header >
<title > XMPP Ping</title>
2006-11-22 13:22:57 -05:00
<abstract > This document defines an XMPP protocol extension for sending pings over XML streams.</abstract>
2006-11-21 18:21:12 -05:00
&LEGALNOTICE;
<number > 0199</number>
2007-05-16 18:35:41 -04:00
<status > Proposed</status>
2006-11-21 18:21:12 -05:00
<type > Standards Track</type>
2007-01-14 22:38:19 -05:00
<sig > Standards</sig>
2006-11-21 18:21:12 -05:00
<approver > Council</approver>
<dependencies >
<spec > XMPP Core</spec>
</dependencies>
<supersedes />
<supersededby />
2007-05-07 15:43:00 -04:00
<shortname > TO BE ASSIGNED</shortname>
2006-11-21 18:21:12 -05:00
&stpeter;
2007-05-07 15:43:00 -04:00
<revision >
<version > 0.3</version>
<date > 2007-05-07</date>
<initials > psa</initials>
<remark > <p > 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.</p> </remark>
</revision>
2006-11-22 13:22:57 -05:00
<revision >
<version > 0.2</version>
<date > 2006-11-22</date>
<initials > psa</initials>
<remark > <p > Changed IQ-set to IQ-get; clarified requirements; specified protocol description; added use cases.</p> </remark>
</revision>
2006-11-21 18:21:12 -05:00
<revision >
<version > 0.1</version>
<date > 2006-11-21</date>
<initials > psa</initials>
<remark > <p > Initial version.</p> </remark>
</revision>
</header>
<section1 topic= 'Introduction' anchor= 'intro' >
2007-05-07 15:43:00 -04:00
<p > As specified in &rfc3920; , 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 &xep0124; method for which &xep0206; is the XMPP profile.</p>
2006-11-21 18:21:12 -05:00
</section1>
<section1 topic= 'Requirements' anchor= 'reqs' >
2007-05-07 15:43:00 -04:00
<p > This specification addresses the following requirements:</p>
2006-11-21 18:21:12 -05:00
<ol start= '1' >
2006-11-22 13:22:57 -05:00
<li > Determining the viability of an XML stream (i.e., its underlying binding) between a client and a server, or between two servers.</li>
<li > Determining end-to-end connectivity between any two XMPP entities (e.g., two clients).</li>
</ol>
2007-05-07 15:43:00 -04:00
<p > 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 (&rfc1393; ); a future specification may define such functionality for XMPP.</p>
2006-11-22 13:22:57 -05:00
</section1>
<section1 topic= 'Protocol' anchor= 'protocol' >
<p > The XMPP ping protocol is extremely simple:</p>
<ol >
2007-05-07 15:43:00 -04:00
<li > The pinging entity sends an IQ-get containing a < ping/> element qualified by the 'http://www.xmpp.org/extensions/xep-0199.html#ns' namespace &NSNOTE; .</li>
2007-05-16 18:35:41 -04:00
<li > The pinged entity returns either an IQ-result (if it supports the namespace) or an IQ-error (if it does not). (See the <link url= '#security' > Security Considerations</link> regarding leaks of presence information in the context of pings sent to clients.)</li>
2006-11-21 18:21:12 -05:00
</ol>
</section1>
<section1 topic= 'Use Cases' anchor= 'usecases' >
2007-05-07 15:43:00 -04:00
<section2 topic= 'Server-To-Client Pings' anchor= 's2c' >
<p > 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.</p>
<example caption= "Ping" > < ![CDATA[
<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>
]]></example>
<p > If the client supports the ping namespace, it MUST return an IQ result:</p>
<example caption= "Pong" > < ![CDATA[
<iq from= 'juliet@capulet.lit/balcony' to= 'capulet.lit' id= 's2c1' type= 'result' />
]]></example>
<p > If the client does not support the ping namespace, it MUST return an IQ error, which SHOULD be &unavailable; :</p>
<example caption= "Ping Not Supported" > < ![CDATA[
<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>
]]></example>
<p > The other error conditions defined in <cite > RFC 3920</cite> could also be returned if appropriate.</p>
</section2>
2006-11-22 13:22:57 -05:00
<section2 topic= 'Client-To-Server Pings' anchor= 'c2s' >
2007-05-07 15:43:00 -04:00
<p > A client may also ping its server by sending an &IQ; get over the stream between the two entities.</p>
2006-11-21 18:21:12 -05:00
<example caption= "Ping" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'juliet@capulet.lit/balcony' to= 'capulet.lit' id= 'c2s1' type= 'get' >
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-21 18:21:12 -05:00
</iq>
]]></example>
2007-05-07 15:43:00 -04:00
<p > Note: The client MAY include a 'to' address of the client's bare JID (&BAREJID; , 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).</p>
<p > If the server supports the ping namespace, it MUST return an IQ result:</p>
2006-11-21 18:21:12 -05:00
<example caption= "Pong" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'capulet.lit' to= 'juliet@capulet.lit/balcony' id= 'c2s1' type= 'result' />
2006-11-21 18:21:12 -05:00
]]></example>
2007-05-07 15:43:00 -04:00
<p > If the server does not support the ping namespace, it MUST return an IQ error, which SHOULD be &unavailable; :</p>
2006-11-21 18:21:12 -05:00
<example caption= "Ping Not Supported" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'capulet.lit' to= 'juliet@capulet.lit/balcony' id= 'c2s1' type= 'error' >
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-21 18:21:12 -05:00
<error type= 'cancel' >
<service-unavailable xmlns= 'urn:ietf:params:xml:ns:xmpp-stanzas' />
</error>
</iq>
]]></example>
2007-05-07 15:43:00 -04:00
<p > The other error conditions defined in <cite > RFC 3920</cite> could also be returned if appropriate.</p>
2006-11-21 18:21:12 -05:00
</section2>
2006-11-22 13:22:57 -05:00
<section2 topic= 'Server-To-Server Pings' anchor= 's2s' >
<p > 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.</p>
<example caption= "Ping" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'capulet.lit' to= 'montague.lit' id= 's2s1' type= 'get' >
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-22 13:22:57 -05:00
</iq>
]]></example>
<p > If the other party to the stream supports the ping namespace, it MUST return an IQ result:</p>
<example caption= "Pong" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'montague.lit' to= 'capulet.lit' id= 's2s1' type= 'result' />
2006-11-22 13:22:57 -05:00
]]></example>
<p > If the other party to the stream does not support the ping namespace, it MUST return an IQ error, which SHOULD be &unavailable; :</p>
<example caption= "Ping Not Supported" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'montague.lit' to= 'capulet.lit' id= 's2s1' type= 'error' >
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-22 13:22:57 -05:00
<error type= 'cancel' >
<service-unavailable xmlns= 'urn:ietf:params:xml:ns:xmpp-stanzas' />
</error>
</iq>
]]></example>
2007-05-07 15:43:00 -04:00
<p > The other error conditions defined in <cite > RFC 3920</cite> could also be returned if appropriate.</p>
2006-11-22 13:22:57 -05:00
</section2>
<section2 topic= 'Client-to-Client Pings' anchor= 'e2e' >
<p > Pings can also be used for client-to-client (i.e., end-to-end) pings.</p>
2006-11-21 18:21:12 -05:00
<example caption= "Ping" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'romeo@montague.lit/home'
to='juliet@capulet.lit/chamber'
2006-11-22 13:22:57 -05:00
type='get'
2007-05-07 15:43:00 -04:00
id='e2e1'>
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-21 18:21:12 -05:00
</iq>
]]></example>
2006-11-22 13:22:57 -05:00
<p > If the pinged entity supports the ping namespace, it SHOULD return an IQ result:</p>
2006-11-21 18:21:12 -05:00
<example caption= "Pong" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'juliet@capulet.lit/chamber'
to='romeo@montague.lit/home'
id='e2e1'
2006-11-22 13:22:57 -05:00
type='result'/>
]]></example>
<p > If the pinged entity does not support the ping namespace, it SHOULD return an IQ error, which SHOULD be &unavailable; :</p>
<example caption= "Ping Not Supported" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'juliet@capulet.lit/chamber'
to='romeo@montague.lit/home'
id='e2e1'
2006-11-22 13:22:57 -05:00
type='result'>
2007-05-07 15:43:00 -04:00
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-22 13:22:57 -05:00
<error type= 'cancel' >
<service-unavailable xmlns= 'urn:ietf:params:xml:ns:xmpp-stanzas' />
</error>
</iq>
]]></example>
2007-05-07 15:43:00 -04:00
<p > The other error conditions defined in <cite > RFC 3920</cite> could also be returned if appropriate.</p>
2006-11-22 13:22:57 -05:00
</section2>
<section2 topic= 'Component-to-Client Pings' anchor= 'other' >
<p > Pings can also be used for component-to-client pings, for example from a &xep0045; component to a client.</p>
<example caption= "Ping" > < ![CDATA[
<iq from= 'chat.shakespeare.lit'
2007-05-07 15:43:00 -04:00
to='juliet@capulet.lit/chamber'
2006-11-22 13:22:57 -05:00
type='get'
2007-05-07 15:43:00 -04:00
id='comp1'>
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-22 13:22:57 -05:00
</iq>
]]></example>
<p > If the pinged entity supports the ping namespace, it SHOULD return an IQ result:</p>
<example caption= "Pong" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'juliet@capulet.lit/chamber'
2006-11-22 13:22:57 -05:00
to='chat.shakespeare.lit'
2007-05-07 15:43:00 -04:00
id='comp1'
2006-11-22 13:22:57 -05:00
type='result'/>
2006-11-21 18:21:12 -05:00
]]></example>
2006-11-22 13:22:57 -05:00
<p > If the pinged entity does not support the ping namespace, it SHOULD return an IQ error, which SHOULD be &unavailable; :</p>
2006-11-21 18:21:12 -05:00
<example caption= "Ping Not Supported" > < ![CDATA[
2007-05-07 15:43:00 -04:00
<iq from= 'juliet@capulet.lit/chamber'
2006-11-22 13:22:57 -05:00
to='chat.shakespeare.lit'
2007-05-07 15:43:00 -04:00
id='comp1'
2006-11-22 13:22:57 -05:00
type='error'>
2007-05-07 15:43:00 -04:00
<ping xmlns= 'http://www.xmpp.org/extensions/xep-0199.html#ns' />
2006-11-21 18:21:12 -05:00
<error type= 'cancel' >
<service-unavailable xmlns= 'urn:ietf:params:xml:ns:xmpp-stanzas' />
</error>
</iq>
]]></example>
2007-05-07 15:43:00 -04:00
<p > The other error conditions defined in <cite > RFC 3920</cite> could also be returned if appropriate.</p>
2006-11-21 18:21:12 -05:00
</section2>
</section1>
2007-05-07 15:43:00 -04:00
<section1 topic= 'Discovering Support' anchor= 'disco' >
<p > 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" &NSNOTE; in response to a &xep0030; information request:</p>
<example caption= "Service Discovery information request" > < ![CDATA[
<iq type= 'get'
from='juliet@capulet.lit/balcony'
from='capulet.lit'
id='disco1'>
<query xmlns= 'http://jabber.org/protocol/disco#info' />
</iq>
]]></example>
<example caption= "Service Discovery information response" > < ![CDATA[
<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>
]]></example>
</section1>
2006-11-21 18:21:12 -05:00
<section1 topic= 'Security Considerations' anchor= 'security' >
2007-05-16 18:35:41 -04:00
<p > 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.</p>
2006-11-21 18:21:12 -05:00
</section1>
<section1 topic= 'IANA Considerations' anchor= 'iana' >
<p > No interaction with &IANA; is necessary as a result of this document.</p>
</section1>
<section1 topic= 'XMPP Registrar Considerations' anchor= 'registrar' >
<section2 topic= 'Protocol Namespaces' anchor= 'registrar-ns' >
2007-05-07 15:43:00 -04:00
<p > 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 ®ISTRAR; shall issue a permanent namespace in accordance with the process defined in Section 4 of &xep0053; .</p>
2006-11-21 18:21:12 -05:00
</section2>
</section1>
<section1 topic= 'XML Schema' anchor= 'schema' >
<code > < ![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
2007-05-07 15:43:00 -04:00
targetNamespace='http://www.xmpp.org/extensions/xep-0199.html#ns'
xmlns='http://www.xmpp.org/extensions/xep-0199.html#ns'
2006-11-21 18:21:12 -05:00
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>
]]></code>
</section1>
</xep>