<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Best Practices for Client Initiated Presence Probes</title>
  <abstract>This specification defines a way to determine the time when a XMPP entity has last changed its presence. Using client initiated presence probes the current presence of subscribed XMPP users can be requested. In addition a protocol to request the uptime of servers and components is defined herein.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>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.</permissions>
<warranty>## 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. ##</warranty>
<liability>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.</liability>
<conformance>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 &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0318</number>
  <status>Deferred</status>
  <type>Informational</type>
  <sig>Standards</sig>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XMPP IM</spec>
    <spec>XEP-0203</spec>
  </dependencies>
  <supersedes>
    <spec>XEP-0012</spec>
  </supersedes>
  <supersededby/>
  <shortname>last-presence</shortname>
  
  <author>
    <firstname>Tobias</firstname>
    <surname>Markmann</surname>
    <email>tobias.markmann@isode.com</email>
    <jid>tm@ayena.de</jid>
  </author>

  <revision>
    <version>0.2</version>
    <date>2013-08-06</date>
    <initials>tobias</initials>
    <remark><p>Fix issues raised in XMPP Council meeting.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2013-03-04</date>
    <initials>psa</initials>
    <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2013-02-20</date>
    <initials>tobias</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
</header>
<section1 topic="Introduction" anchor="intro">
<p><span class="ref"><link url="http://tools.ietf.org/html/rfc6121">RFC 6121</link></span> <note>RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence &lt;<link url="http://tools.ietf.org/html/rfc6121">http://tools.ietf.org/html/rfc6121</link>&gt;.</note>, section 4.3, defines presence probes as a way for servers to actively ping for presence status of XMPP contacts. In some scenarios however, clients want to request an update on the status of a XMPP contact.</p>
</section1>
<section1 topic="Rationale" anchor="rationale">
<p>While <span class="ref"><link url="http://tools.ietf.org/html/rfc6121">RFC 6121</link></span> <note>RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence &lt;<link url="http://tools.ietf.org/html/rfc6121">http://tools.ietf.org/html/rfc6121</link>&gt;.</note> specifically advises against (SHOULD NOT) clients sending presence probes to XMPP contacts, there are valid scenarios where XMPP clients want to send presence probes.</p>
<p>According to <span class="ref"><link url="http://tools.ietf.org/html/rfc6121">RFC 6121</link></span> <note>RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence &lt;<link url="http://tools.ietf.org/html/rfc6121">http://tools.ietf.org/html/rfc6121</link>&gt;.</note>, contacts a client doesn't have presence information on, are expected to be offline and server aren't mandated to explicitly send offline presence to the client for offline users.</p>
<p>In addition, clients in constrained environments (i.e. mobile clients), could explicitly tell the server to filter out presence stanzas of certain kind, to keep communication to a minimum. One such protocol is <span class="ref"><link url="https://xmpp.org/extensions/xep-0273.html">Stanza Interception and Filtering Technology (XEP-0273)</link></span> <note>XEP-0273: Stanza Interception and Filtering Technology &lt;<link url="https://xmpp.org/extensions/xep-0273.html">https://xmpp.org/extensions/xep-0273.html</link>&gt;.</note>.</p>
<p>This causes presence information to be outdated and any information, that might have been attached to the offline presence, i.e. <span class="ref"><link url="https://xmpp.org/extensions/xep-0203.html">Delayed Delivery (XEP-0203)</link></span> <note>XEP-0203: Delayed Delivery &lt;<link url="https://xmpp.org/extensions/xep-0203.html">https://xmpp.org/extensions/xep-0203.html</link>&gt;.</note>, to be missing at client side.</p>
<p>Sending presence probes from the client should be based on human request, i.e. opening a chat dialog to an offline contact when messing full presence information for that contact. Clients MUST NOT send presence probes to all contacts that they think are offline after login.</p>
</section1>
<section1 topic="Use Cases" anchor="usecases">
<p>This section describes two major use cases of the described protocol, client initiated presence probes.</p>
<section2 topic="Requesting up-to-date Presence of a XMPP Entity" anchor="presence-pull">
<p>In some situations, after login, the client has incomplete presence information for offline contacts. The user might be interested in status text of the offline presence of a contact or when a contact went offline. This information can be requested, i.e. when the user opens a chat dialog to an offline user, using a client initiated presence probe and is described in the following two examples.</p>
<p>Initialilly a client requests the current presence information of a contact by sending out a presence probe.</p>
<example caption="Request for up-to-date Presence using Presence Probe"><![CDATA[
<presence from='juliet@capulet.com/balcony' to='romeo@montague.com' type='probe' />]]></example>
<p>The other side's server, in this example montague.com, then responds with the last known presence of the user, including <span class="ref"><link url="https://xmpp.org/extensions/xep-0203.html">Delayed Delivery (XEP-0203)</link></span> <note>XEP-0203: Delayed Delivery &lt;<link url="https://xmpp.org/extensions/xep-0203.html">https://xmpp.org/extensions/xep-0203.html</link>&gt;.</note> and other information provided by the user.</p>
<example caption="Presence Reply in Response to Presence Probe"><![CDATA[
<presence from='romeo@montague.com' to='juliet@capulet.com/balcony' type='unavailable'>
  <status>Going offline. Out of battery.</status>
  <delay xmlns='urn:xmpp:delay'
     from='romeo@montague.com/balcony'
     stamp='2012-09-10T23:41:07Z'/>
</presence>]]></example>
</section2>
<section2 topic="Requesting Uptime of a XMPP Server" anchor="uptime-request">
<p>XMPP servers typically don't have all the properties known from XMPP clients, like presence or rosters. However, <span class="ref"><link url="https://xmpp.org/extensions/xep-0267.html">Server Buddies (XEP-0267)</link></span> <note>XEP-0267: Server Buddies &lt;<link url="https://xmpp.org/extensions/xep-0267.html">https://xmpp.org/extensions/xep-0267.html</link>&gt;.</note> for example added rosters to XMPP servers.</p>
<p>In a similar manner, this extension describes the use of presence for XMPP servers and XMPP components. Basically, when a XMPP server or component starts up it's expected to set its presence to online.</p>
<p>With this concept, any party could easily request the time a XMPP server or component went online, by sending a presence probe to it.</p>
<example caption="Request for Presence of a XMPP Server"><![CDATA[
<presence from='juliet@capulet.com/balcony' to='montague.com' type='probe' />]]></example>
<p>In response, the requester receives a presence stanza, which contains <span class="ref"><link url="https://xmpp.org/extensions/xep-0203.html">Delayed Delivery (XEP-0203)</link></span> <note>XEP-0203: Delayed Delivery &lt;<link url="https://xmpp.org/extensions/xep-0203.html">https://xmpp.org/extensions/xep-0203.html</link>&gt;.</note> information, indicating the time the server went online.</p>
<example caption="Response from XMPP Server indicating uptime"><![CDATA[
<presence from='montague.com' to='juliet@capulet.com/balcony'>
  <delay xmlns='urn:xmpp:delay'
     from='montague.com'
     stamp='2012-09-10T23:41:07Z'/>
</presence>]]></example>
</section2>
</section1>
<section1 topic="Acknowledgements" anchor="ack">
  <p>Thanks to Kim Alvefur and Lance Stout for their helpful comments.</p>
</section1>
<section1 topic="Security Considerations" anchor="security">
  <p>Adding delayed delivery notation to the presence probe responses exposes information a user might not expect to have exposed. However, the information about last presence change is known to all entities subscribed to one's presence which are online. This extension just provides this information to XMPP entities which have been offline during the course of presence change.</p>
  <p>The security considerations of <span class="ref"><link url="https://xmpp.org/extensions/xep-0082.html">XMPP Date and Time Profiles (XEP-0082)</link></span> <note>XEP-0082: XMPP Date and Time Profiles &lt;<link url="https://xmpp.org/extensions/xep-0082.html">https://xmpp.org/extensions/xep-0082.html</link>&gt;.</note> apply here.</p>
</section1>
<section1 topic="IANA Considerations" anchor="iana">
  <p>This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>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 &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <p>This document requires no interaction with the <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>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 &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note>.</p>
</section1>
</xep>
