<abstract>This specification defines an XMPP protocol extension for message receipts, whereby the sender of a message can request notification that it has been received by the intended recipient.</abstract>
<li>Explicitly discouraged dependence on receipts unless some other protocol is used to negotiate the use of message receipts.</li>
<li>Provided explicit recommendations about when and when not to request receipts.</li>
<li>Relaxed the business rules to allow inclusion of receipt requests even to the bare JID and even if the sender does not yet know whether the intended recipient supports this protocol.</li>
<li>Added 'id' attribute to <received/> element for tracking purposes.</li>
<remark><p>Added two more scenarios; defined business rule about not sending to bare JIDs; specified security consideration regarding presence leaks.</p></remark>
<remark><p>Added text and examples for service discovery; added text and examples for chat session negotiation; added recommendations regarding message processing, retries, etc.</p></remark>
<p>While &xep0079; provides message acknowledgements at the server level, it does not extend that model all the way to the client. <note>Naturally, message receipts can be combined with the rules specified in <cite>Advanced Message Processing</cite> for more complete reporting.</note> However, sometimes client-level acknowledgements are needed, for example to provide "receipts". This document defines a mechanism for XMPP message receipts, which are functionally equivalent to the "delivered" or "displayed" event in &xep0022;, which this specification in part obsoletes. <note>This specification does not distinguish between delivery and presentation, as was done in the message events protocol, in part because no existing clients make the distinction.</note></p>
<p>Note: This extension is functionally equivalent to an <cite>Advanced Message Processing</cite> rule of "receipt" but uses a dedicated namespace to simplify processing by end user clients and intermediate routers.</p>
<p>This document defines a protocol that enables a sender to ask the recipient to return a receipt for a message. Although the return of a message receipt lets the sender know that the message has been delivered, there are many reasons why the sender might not receive a receipt immediately or at all, including but not limited to the following:</p>
<li>The sender addressed the message to the recipient's bare JID &LOCALBARE; and therefore does not know if the recipient even supports message receipts.</li>
<li>The sender has not bothered to determine whether the recipient supports message receipts.</li>
<li>The recipient (or the particular intended resource to which the sender addressed the message) does not in fact support message receipts.</li>
<li>The intended resource supports message receipts but the recipient's server delivers the message to another resource that does not support message receipts.</li>
<li>The recipient's client receives the message but experiences a malfunction before generating a receipt.</li>
<li>The recipient returns a receipt but the receipt is lost on the way back from the recipient to the sender (e.g., because of connectivity issues or software failures at any hop).</li>
<p>Because of these significant limitations, this protocol does not provide complete or even partial reliability or guaranteed delivery. Therefore, the sender SHOULD NOT impute any meaning to the lack of a receipt unless it has established with the recipient that receipt requests will be honored; however, methods for doing so are out of scope for this specification and it is NOT RECOMMENDED to take any particular action (such as resending a message) without such methods. <note>This protocol merely provides a building block that could be used in conjunction with other protocols to asymptotically approach the eventual goal of messaging reliability and guaranteed delivery.</note></p>
<section1topic='When to Request Receipts'anchor='when'>
<p>A sender <em>could</em> request receipts on any non-error message (chat, groupchat, headline, or normal) no matter if the recipient's address is a bare JID &LOCALBARE; or a full JID &LOCALFULL;. Whether it is <em>appropriate</em> or <em>advisable</em> to do so it another question. This section provides recommendations about when and when not to request receipts, and what results to expect in each scenario.</p>
<section2topic='Bare JID'anchor='when-bare'>
<p>If the sender knows only the recipient's bare JID, it cannot cannot determine (via disco or caps) whether the intended recipient supports message receipts. In this case, the sender MAY request a receipt when sending a message of type "chat", "headline", or "normal" to the recipient's bare JID. However, the sender MUST NOT depend on receiving a receipt.</p>
</section2>
<section2topic='Full JID'anchor='when-full'>
<p>If the sender knows a full JID for the recipient (e.g., via presence), it SHOULD attempt to determine (via disco or caps) whether the client at that full JID supports message receipts before attempting to request receipts.</p>
<p>If the sender determines that the recipient's client does not support message receipts then it SHOULD NOT request a receipt when sending a message to that full JID and MUST NOT depend on receiving a receipt.</p>
<p>If the sender determines that the recipient's client supports message receipts then it MAY request a receipt when sending a message of type "chat", "headline", or "normal" to that full JID. However, even in this case the sender SHOULD NOT depend on receiving a receipt.</p>
<p>It is NOT RECOMMENDED to request a receipt when sending a message of type "groupchat" in a &xep0045; room because the logic for determining when a message is truly "received" by all of the room occupants is complex and because the sender would receive one receipt from each occupant of the room, thus significantly increasing the number of messages sent through the room.</p>
<p>If an entity supports message receipts, it MUST report that by including a &xep0030; feature of "urn:xmpp:receipts" in response to disco#info requests:</p>
<examplecaption="Initial Service Discovery information request"><![CDATA[
<p>In order to make it possible for senders to request and for recipients to generate message receipts, we define a dedicated protocol extension qualified by the 'urn:xmpp:receipts' namespace.</p>
<p>Specifically, the receiving entity shall return a <received/> notice if it has received and processed the message. The term "processed" is understood to include presentation to a human user if appropriate or any other application-specific client-side processing, including generation of an error response if the application determines that the message contents cannot be handled.</p>
<pclass='box'>Note: A sender MUST include an 'id' attribute on every message that requests a receipt, so that the sender can properly track the receipt.</p>
<p>The recipient shall generate a receipt if and only if it supports the protocol defined herein and it is configured to return receipts, either globally or for this recipient (otherwise it MUST NOT return a receipt and SHOULD NOT return an error).</p>
<p>The <received/> element SHOULD be the only child of the &MESSAGE; stanza and SHOULD include an 'id' attribute that echoes the 'id' attribute of the sent message.</p>
<p>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.</p>