XEP-0256: Last Activity in Presence

Abstract
This specification defines a way to use the Last Activity extension in XMPP presence notifications.
Author
Peter Saint-Andre
Copyright
© 1999 – 2020 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Draft

NOTICE: The protocol defined herein is a Draft Standard of the XMPP Standards Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.
Type
Standards Track
Version
1.1 (2009-09-15)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Draft
  4. Final

1. Use Cases

Last Activity (XEP-0012) [1] defines a method for determining the last time that an XMPP entity was active. This document specifies that an online client MAY include last activity information when sending a presence update. Including such information essentially means "when I sent this presence notification I had last been active at time T".

There are two primary use cases:

  1. When a client sends initial presence to start a presence session, the last activity notation indicates when that client terminated its previous presence session.
  2. When a client changes from available to "away" or "xa", the last activity notation indicates when that client was last active during the current presence session.

The following sections show examples of each use case.

1.1 Initial Presence

When a client begins a presence session, it can indicate when that particular client was last online. It does this by sending initial presence with a last activity notation.

Example 1. Last Indication in Initial Presence
<presence from='juliet@capulet.com/balcony'>
  <query xmlns='jabber:iq:last' seconds='86511'/>
</presence>

This can be read as "I'm now online and I was last online at this client 24 hours and 111 seconds ago".

Including last activity information in an initial presence notification enables Publish-Subscribe (XEP-0060) [2] and Personal Eventing Protocol (XEP-0163) [3] nodes to optimize item delivery (e.g., by sending only the items that were published after a subscriber went offline the last time) and enables Multi-User Chat (XEP-0045) [4] rooms to optimize the delivery of discussion history messages.

1.2 Away and Extended Away

When a client automatically sets the user's <show/> value to "away" or "xa" (extended away), it can indicate when that particular was last active during the current presence session.

Example 2. Last Indication in Auto-Away
<presence from='juliet@capulet.com/balcony'>
  <show>away</show>
  <query xmlns='jabber:iq:last' seconds='600'/>
</presence>

This can be read as "I just went away and I was last active 10 minutes ago".

If one of the user's contacts receives that presence notification with delayed delivery (see Delayed Delivery (XEP-0203) [5]) on login in response to a presence probe as described in XMPP IM [6], the contact will then know how long the user has been idle (i.e., the number of seconds since the delayed delivery timestamp, plus the iq:last seconds). Thus the contact does not need to send an iq:last query.

Example 3. Last Indication in Auto-Away With Delayed Delivery
<presence from='juliet@capulet.com/balcony' to='romeo@montague.net'>
  <show>away</show>
  <query xmlns='jabber:iq:last' seconds='600'/>
  <delay xmlns='urn:xmpp:delay'
     from='capulet.com'
     stamp='2002-09-10T23:41:07Z'/>
</presence>

2. Security Considerations

Including a last activity notation in presence notifications can enable those who receive such notifications to determine exactly when a user has stopped interacting with his or her XMPP client, but this information is in essence already available if the user publishes timely presence updates. Therefore, this specification introduces no new vulnerabilities.

3. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [7].

4. XMPP Registrar Considerations

This document requires no interaction with the XMPP Registrar [8].


Appendices

Appendix A: Document Information

Series
XEP
Number
0256
Publisher
XMPP Standards Foundation
Status
Draft
Type
Standards Track
Version
1.1
Last Updated
2009-09-15
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM, XEP-0012
Supersedes
None
Superseded By
None
Short Name
N/A
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Peter Saint-Andre
Email
xsf@stpeter.im
JabberID
peter@jabber.org
URI
http://stpeter.im/

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2020 by the XMPP Standards Foundation (XSF).

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.

Disclaimer of 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. ##

Limitation of 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.

IPR 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 <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

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.

Appendix D: Relation to XMPP

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.

Appendix E: Discussion Venue

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 <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

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

Appendix G: Notes

1. XEP-0012: Last Activity <https://xmpp.org/extensions/xep-0012.html>.

2. XEP-0060: Publish-Subscribe <https://xmpp.org/extensions/xep-0060.html>.

3. XEP-0163: Personal Eventing Protocol <https://xmpp.org/extensions/xep-0163.html>.

4. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

5. XEP-0203: Delayed Delivery <https://xmpp.org/extensions/xep-0203.html>.

6. RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc6121>.

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 <https://xmpp.org/registrar/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

  1. Version 1.1 (2009-09-15)

    Added use case for initial presence.

    psa
  2. Version 1.0 (2009-05-06)

    Per a vote of the XMPP Council, advanced specification to Draft.

    psa
  3. Version 0.1 (2008-11-26)

    Initial published version; removed note about handling the absence of a last activity notation; added security considerations.

    psa
  4. Version 0.0.1 (2008-11-20)

    Rough draft based on list discussion.

    psa

END