This document specifies an XMPP protocol extension for message receipts.
WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the Jabber Software Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems should not deploy implementations of this protocol until it advances to a status of Draft.
Status:
Experimental
Type:
Standards Track
Number: 0184
Version: 0.2
Last Updated: 2006-09-21
Publishing Organization: Jabber Software Foundation
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: XEP-0022 (in part)
Superseded By: None
Short Name: amp-receipts
Wiki Page: <http://wiki.jabber.org/index.php/Message Receipts (XEP-0184)>
Email:
stpeter@jabber.org
JID:
stpeter@jabber.org
Email:
jhildebrand@jabber.com
JID:
hildjj@jabber.org
This XMPP Extension Protocol is copyright 1999 - 2006 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF'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/>).
The preferred venue for discussion of this document is the Standards-JIG discussion list: <http://mail.jabber.org/mailman/listinfo/standards-jig>.
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the Jabber Software 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 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".
While Advanced Message Processing [1] provides message acknowledgements at the server level, it does not extend that model all the way to the client. However, sometimes client-level acknowledgements are needed, for example to provide "receipts". This document defines a mechanism for XMPP message receipts.
This document addresses the following requirements:
Note: This document explicitly does not define a protocol for "guaranteed delivery", since that term (like "security") means different things to different people. Instead, we define a more focused protocol that addresses the need for message receipts, thus solving one problem that falls under the heading of "guaranteed delivery".
In general there are seven possible scenarios (where "S" stands for sender and "R" stands for recipient):
S R | | | ------------------------------------> | | send message | | | | <------------------------------------ | | send receipt | | |
In Scenario 1, the use case ends successfully with message delivery, receipt delivery, and no retries.
S R | | | -----------------------------x | | send message | | | | [trigger timeout] | | | | ------------------------------------> | | re-send message | | | | <------------------------------------ | | send receipt | | |
In Scenario 2, the use case ends successfully with message delivery failure, message retry, and receipt delivery.
S R | | | ------------------------------------> | | send message | | | | x------------------------------- | | send receipt | | | | [trigger timeout] | | | | ------------------------------------> | | re-send message | | | | <------------------------------------ | | send receipt | | |
In Scenario 3, the use case ends successfully with message delivery, receipt delivery failure, message retry, and receipt delivery.
S R | | | ------------------------------------> | | send message | | | | ------------------------------------> | | send presence unavailable | | |
In Scenario 4, the use case ends unsuccessfully with message delivery and the sender generating presence unavailable (because the sender has gone offline, the recipient has no one to send the receipt to).
S R | | | ------------------------------------> | | send message | | | | -------------------------------x | | send presence unavailable | | | | <------------------------------------ | | send receipt | | |
In Scenario 5, the use case ends unsuccessfully with message delivery and the sender generating presence unavailable; however, the presence unavailable is not delivered, so the recipient sends a receipt, which is not delivered within the sender's timeout period since the sender is now offline.
S R | | | ------------------------------------> | | send message | | | | <------------------------------------ | | send presence unavailable | | |
In Scenario 6, the use case ends unsuccessfully with message delivery and the recipient generating presence unavailable (because the recipient has gone offline before sending a receipt, the sender cannot be sure that the message has been received).
S R | | | ------------------------------------> | | send message | | | | x---------------------------------- | | send presence unavailable | | | | [trigger timeout] | | | | ------------------------------------> | | re-send message | | |
In Scenario 7, the use case ends unsuccessfully with message delivery and the recipient generating presence unavailable; however, the presence unavailable is not delivered, so the sender retries sending the message and because the recipient is now offline it cannot send a receipt within the sender's timeout period.
In order to make it possible for senders to request, and for recipients to generate, message receipts, we define a new Advanced Message Processing rule: "receipt". In accordance with XEP-0079, we provide the following information about the receipt rule:
In order to make it possible for senders to request, and for recipients to generate, message receipts, we define a new Advanced Message Processing rule: "receipt". In accordance with XEP-0079, we provide the following information about the receipt rule:
The following is an example of a message that includes a request for return receipt.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
If the recipient supports Advanced Message Processing and the "receipt" rule, it MUST generate a receipt:
<message from='kingrichard@royalty.england.lit/throne' id='richard2-4.1.247' to='northumberland@shakespeare.lit/westminster'> <amp xmlns='http://jabber.org/protocol/amp' status='notify'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
The general business rules specified for Advanced Message Processing in XEP-0079 apply to any rule; in addition, the following business rules apply specifically to the receipt rule:
A sender SHOULD NOT include a request for message receipts when sending a message to the bare JID (<node@domain.tld>) of the recipient, only when sending to a full JID (<node@domain.tld/resource>).
A sender SHOULD NOT include a request for message receipts unless it knows (via Service Discovery [6] or Entity Capabilities [7]) that the intended recipient supports the protocol described herein or unless the use of message receipts is negotiated via Chat Session Negotiation [8].
The sender (i.e., the message generating application controlled by the sender) MUST initiate a timeout upon sending each message, which timeout SHOULD be 30 seconds. If the sender does not receive a message receipt (or failure event) within its timeout period, it MUST re-send the message with an identical value of the XMPP 'id' attribute.
The sender MUST NOT send a large number of retries. How many retries are appropriate depends on how important the message is perceived to be. In any case, a sender SHOULD NOT send more than five retries.
The recipient (i.e., the message processing application controlled by the intended recipient that receives a given message) MUST initiate a timeout upon sending each message receipt, which timeout SHOULD be 60 seconds. If the recipient does not receive a re-sent message within its timeout period, it SHOULD stop waiting for a re-sent message and discard memory of that message ID.
The recipient MUST NOT include a request for message receipts in its acknowledgements. If the sender receives a request for message receipts in an acknowledgement, it MUST NOT acknowledge the acknowledement.
The recipient SHOULD send the message receipt once it has processed the message, which may include presenting it to a human user (e.g., visually or aurally). The receiving application SHOULD NOT require a human user to positively affirm that he or she has read and understood the message before sending the receipt, since this is unnecessarily intrusive in the context of instant messaging.
Naturally, the receipt rule can be combined wiith rules specified in XEP-0079 (e.g., the deliver rule) for more complete reporting.
This document covers one use case: sending messages with return receipt requested, for which succcess is defined as the sender receiving a message receipt. As described above, there are seven possible scenarios. These are described in more detail in the following sections.
In the "happy path", the sender sends the message and the recipient returns a receipt within the sender's timeout period.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
<message from='kingrichard@royalty.england.lit/throne' id='richard2-4.1.247' to='northumberland@shakespeare.lit/westminster'> <amp xmlns='http://jabber.org/protocol/amp' status='notify'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
In this scenario the sender sends the message but it is not received for whatever reason; therefore the sender resends the message after the timeout period expires, the resent message is received, and the recipient returns a receipt within the sender's (second) timeout period.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
The message is not received and the sender does not receive a receipt within the sender's timeout period; therefore the sender resends the message.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
Now the message is received and the recipient returns a receipt.
<message from='kingrichard@royalty.england.lit/throne' id='richard2-4.1.247' to='northumberland@shakespeare.lit/westminster'> <amp xmlns='http://jabber.org/protocol/amp' status='notify'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
In this scenario the sender sends the message and it not received, but the message receipt is not received for whatever reason; therefore the sender resends the message after the timeout period expires, the resent message is received, and the recipient returns a receipt within the sender's (second) timeout period.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
The message is received and the recipient returns a receipt.
<message from='kingrichard@royalty.england.lit/throne' id='richard2-4.1.247' to='northumberland@shakespeare.lit/westminster'> <amp xmlns='http://jabber.org/protocol/amp' status='notify'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
The message receipt is not received by the sender within the sender's timeout period; therefore the sender resends the message.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
The resent message is received and the recipient returns a receipt, which is received by the sender within the sender's (second) timeout period.
<message from='kingrichard@royalty.england.lit/throne' id='richard2-4.1.247' to='northumberland@shakespeare.lit/westminster'> <amp xmlns='http://jabber.org/protocol/amp' status='notify'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
In this scenario the sender sends the message but immediately goes offline. Therefore the recipient MUST NOT send a receipt.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
<presence from='northumberland@shakespeare.lit/westminster' to='kingrichard@royalty.england.lit/throne' type='unavailable'/>
The use case ends unsuccessfully, since the sender did not receive a receipt.
In this scenario the sender sends the message but immediately goes offline, however the sender's presence unavailable is not delivered to the recipient so the recipient sends a receipt but the sender's timeout is not triggered.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
<presence from='northumberland@shakespeare.lit/westminster' type='unavailable'/>
The recipient does not receive the presence unavailable so sends a message receipt.
<message from='kingrichard@royalty.england.lit/throne' id='richard2-4.1.247' to='northumberland@shakespeare.lit/westminster'> <amp xmlns='http://jabber.org/protocol/amp' status='notify'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
However, the sender does not receive the receipt within its timeout period (since it is now offline), so the use case ends unsuccessfully.
In this scenario the sender sends the message but receives unavailable presence from the recipient before receiving a receipt within the timeout period.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
<presence from='kingrichard@royalty.england.lit/throne' to='northumberland@shakespeare.lit/westminster' type='unavailable'/>
The use case ends unsuccessfully, since the sender did not receive a receipt.
In this scenario the sender sends the message and the recipient sends unavailable presence before sending a receipt, but the presence unavailable is not delivered so the sender retries but does not receive a receipt since the recipient is now offline; after some number of retries the sender gives up and cannot be sure that the message was ever received.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
<presence from='kingrichard@royalty.england.lit/throne' type='unavailable'/>
The sender does not receive the presence unavailable so sends a retry.
<message from='northumberland@shakespeare.lit/westminster' id='richard2-4.1.247' to='kingrichard@royalty.england.lit/throne'> <body>My lord, dispatch; read o'er these articles.</body> <amp xmlns='http://jabber.org/protocol/amp'> <rule condition='receipt' action='notify' value='received'/> </amp> </message>
After sending some number of retries the sender gives up and the use case ends unsuccessfully.
If a sender wishes to request message receipts, it SHOULD first discover whether the intended recipient supports message receipts. Support can be discovered indirectly via Entity Capabilities or directly via Service Discovery.
If an entity supports Advanced Message Processing, it MUST report that by including a service discovery feature of "http://jabber.org/protocol/amp" as described in XEP-0079:
<iq from='northumberland@shakespeare.lit/westminster' to='kingrichard@royalty.england.lit/throne' type='get'> <query xmlns='http://jabber.org/protocol/disco#info'/> </iq>
<iq from='kingrichard@royalty.england.lit/throne' to='northumberland@shakespeare.lit/westminster' type='result'> <query xmlns='http://jabber.org/protocol/disco#info'> ... <feature var='http://jabber.org/protocol/amp'/> ... </query> </iq>
An entity that supports Advanced Message Processing SHOULD also maintain a service discovery node named "http://jabber.org/protocol/amp", at which it advertises the individual actions and conditions it supports. If an entity supports message receipts, it SHOULD respond to service discovery information requests sent to that node with a reply that includes the 'http://jabber.org/protocol/amp?condition=receipt' condition:
<iq from='northumberland@shakespeare.lit/westminster' to='kingrichard@royalty.england.lit/throne' type='get'> <query xmlns='http://jabber.org/protocol/disco#info' node='http://jabber.org/protocol/amp'/> </iq>
<iq from='kingrichard@royalty.england.lit/throne' to='northumberland@shakespeare.lit/westminster' type='result'> <query xmlns='http://jabber.org/protocol/disco#info' node='http://jabber.org/protocol/amp'> ... <feature var='http://jabber.org/protocol/amp?condition=receipt'/> ... </query> </iq>
Two entities MAY negotiate the use of message receipts for a given session using Chat Session Negotiation. The parameter to be negotiated is named "http://jabber.org/protocol/amp?condition=receipt". Its use is illustrated in the following examples.
<message type='normal' from='northumberland@shakespeare.lit/westminster' to='kingrichard@royalty.england.lit/throne' id='init1'> <thread>ffd7076498744578d10edabfe7f4a866</thread> <feature xmlns='http://jabber.org/protocol/feature-neg'> <x xmlns='jabber:x:data' type='form'> <field var='FORM_TYPE' type='hidden'> <value>http://jabber.org/protocol/chatneg</value> </field> <field label='Accept this chat?' type='boolean' var='accept'> <value>true</value> <required/> </field> <field label='Enable Message Receipts?' type='boolean' var='http://jabber.org/protocol/amp?condition=receipt'> <value>0</value> </field> </x> </feature> </message>
<message type='normal' from='kingrichard@royalty.england.lit/throne' to='northumberland@shakespeare.lit/westminster' id='init1'> <thread>ffd7076498744578d10edabfe7f4a866</thread> <feature xmlns='http://jabber.org/protocol/feature-neg'> <x xmlns='jabber:x:data' type='submit'> <field var='FORM_TYPE' type='hidden'> <value>http://jabber.org/protocol/chatneg</value> </field> <field var='accept'> <value>true</value> </field> <field var='http://jabber.org/protocol/amp?condition=receipt'> <value>1</value> </field> </x> </feature> </message>
It is possible for a recipient to leak its presence when returning message receipts; therefore, a recipient SHOULD NOT return message receipts to senders who are not otherwise authorized to view its presence.
No interaction with the Internet Assigned Numbers Authority (IANA) [9] is necessary as a result of this document.
The XMPP Registrar [10] maintains a registry of Advanced Message Processing <rule/> conditions (see <http://www.xmpp.org/registrar/amp-conditions.html>). The Registrar shall add the following condition to the registry:
<condition> <name>receipt</name> <ns>http://jabber.org/protocol/amp?condition=receipt</ns> <per-hop>false</per-hop> <value>received</value> <processing> The condition is met if a message processing application (client) controlled by the intended recipient has received and processed the message, including presentation to a human user if appropriate. </processing> <doc>XEP-xxxx</doc> </condition>
Field Standardization for Data Forms [11] defines a process for standardizing the fields used within Data Forms qualified by a particular namespace and the XMPP Registrar maintains a registry of such fields (see <http://www.xmpp.org/registrar/formtypes.html>). The Registrar shall add the following field for use in Chat Session Negotiation forms:
<form_type> <name>http://jabber.org/protocol/chatneg</name> <field var='http://jabber.org/protocol/amp?condition=receipt' type='boolean' label='Whether to enable Message Receipts per XEP-0184'/> </form_type>
Thanks to Joe Kemp for his input.
1. XEP-0079: Advanced Message Processing <http://www.xmpp.org/extensions/xep-0079.html>.
2. Therefore this specification does not distinguish between delivery and presentation, as was done in Message Events [3].
3. XEP-0022: Message Events <http://www.xmpp.org/extensions/xep-0022.html>.
4. Therefore this specification does not distinguish between delivery and presentation, as was done in Message Events [5].
5. XEP-0022: Message Events <http://www.xmpp.org/extensions/xep-0022.html>.
6. XEP-0030: Service Discovery <http://www.xmpp.org/extensions/xep-0030.html>.
7. XEP-0115: Entity Capabilities <http://www.xmpp.org/extensions/xep-0115.html>.
8. XEP-0155: Chat Session Negotiation <http://www.xmpp.org/extensions/xep-0155.html>.
9. 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/>.
10. 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 Jabber Software Foundation. For further information, see <http://www.xmpp.org/registrar/>.
11. XEP-0068: Field Data Standardization for Data Forms <http://www.xmpp.org/extensions/xep-0068.html>.
Added two more scenarios; defined business rule about not sending to bare JIDs; specified security consideration regarding presence leaks.
(psa)Initial version.
(psa)Added text and examples for service discovery; added text and examples for chat session negotiation; added recommendations regarding message processing, retries, etc.
(psa)First draft.
(psa)END