git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@174 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Peter Saint-Andre 2006-11-07 04:01:23 +00:00
parent 71a7aaa31a
commit bfec2848c5
1 changed files with 21 additions and 337 deletions

View File

@ -24,6 +24,12 @@
<shortname>amp-receipts</shortname>
&stpeter;
&hildjj;
<revision>
<version>0.3</version>
<date>2006-11-06</date>
<initials>psa</initials>
<remark><p>Removed reliability features, which belong at a different level.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2006-09-21</date>
@ -50,7 +56,8 @@
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>While &xep0079; 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.</p>
<p>While &xep0079; 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, 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>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>This document addresses the following requirements:</p>
@ -60,123 +67,13 @@
</ol>
<p>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".</p>
</section1>
<section1 topic='Scenarios' anchor='scenarios'>
<p>In general there are seven possible scenarios (where "S" stands for sender and "R" stands for recipient):</p>
<code caption='Scenario 1: Happy Path'><![CDATA[
S R
| |
| ------------------------------------> |
| send message |
| |
| <------------------------------------ |
| send receipt |
| |
]]></code>
<p>In Scenario 1, the use case ends successfully with message delivery, receipt delivery, and no retries.</p>
<code caption='Scenario 2: Message Not Received'><![CDATA[
S R
| |
| -----------------------------x |
| send message |
| |
| [trigger timeout] |
| |
| ------------------------------------> |
| re-send message |
| |
| <------------------------------------ |
| send receipt |
| |
]]></code>
<p>In Scenario 2, the use case ends successfully with message delivery failure, message retry, and receipt delivery.</p>
<code caption='Scenario 3: Receipt Not Received'><![CDATA[
S R
| |
| ------------------------------------> |
| send message |
| |
| x------------------------------- |
| send receipt |
| |
| [trigger timeout] |
| |
| ------------------------------------> |
| re-send message |
| |
| <------------------------------------ |
| send receipt |
| |
]]></code>
<p>In Scenario 3, the use case ends successfully with message delivery, receipt delivery failure, message retry, and receipt delivery.</p>
<code caption='Scenario 4: Message Sent, Sender Goes Offline'><![CDATA[
S R
| |
| ------------------------------------> |
| send message |
| |
| ------------------------------------> |
| send presence unavailable |
| |
]]></code>
<p>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).</p>
<code caption='Scenario 5: Message Sent, Sender Goes Offline, Presence Not Received'><![CDATA[
S R
| |
| ------------------------------------> |
| send message |
| |
| -------------------------------x |
| send presence unavailable |
| |
| <------------------------------------ |
| send receipt |
| |
]]></code>
<p>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.</p>
<code caption='Scenario 6: Message Sent, Recipient Goes Offline'><![CDATA[
S R
| |
| ------------------------------------> |
| send message |
| |
| <------------------------------------ |
| send presence unavailable |
| |
]]></code>
<p>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).</p>
<code caption='Scenario 7: Message Sent, Recipient Goes Offline, Presence Not Received'><![CDATA[
S R
| |
| ------------------------------------> |
| send message |
| |
| x---------------------------------- |
| send presence unavailable |
| |
| [trigger timeout] |
| |
| ------------------------------------> |
| re-send message |
| |
]]></code>
<p>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.</p>
</section1>
<section1 topic='Protocol Format' anchor='format'>
<p>In order to make it possible for senders to request, and for recipients to generate, message receipts, we define a new <cite>Advanced Message Processing</cite> rule: "receipt". In accordance with <cite>XEP-0079</cite>, we provide the following information about the receipt rule:</p>
<p>In order to make it possible for senders to request and for recipients to generate message receipts, we define a new <cite>Advanced Message Processing</cite> rule: "receipt". In accordance with <cite>XEP-0079</cite>, we provide the following information about the receipt rule:</p>
<ul>
<li>The namespace shall be "http://jabber.org/protocol/amp?condition=receipt".</li>
<li>The condition applies only to final receipt by the intended recipient; therefore, the per-hop flag does not apply.</li>
<li>The only defined value of the receipt rule is "received".</li>
<li>This condition is met if a message processing application (client) controlled by the intended recipient has received and processed the message; the term "processed" is understood to include presentation to a human user if appropriate <note>Therefore this specification does not distinguish between delivery and presentation, as was done in &xep0022;.</note> 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.</li>
</ul>
</section1>
<section1 topic='Protocol Format' anchor='format'>
<p>In order to make it possible for senders to request, and for recipients to generate, message receipts, we define a new <cite>Advanced Message Processing</cite> rule: "receipt". In accordance with <cite>XEP-0079</cite>, we provide the following information about the receipt rule:</p>
<ul>
<li>The namespace shall be "http://jabber.org/protocol/amp?condition=receipt".</li>
<li>The condition applies only to final receipt by the intended recipient; therefore, the per-hop flag does not apply.</li>
<li>The only defined value of the receipt rule is "received".</li>
<li>This condition is met if a message processing application (client) controlled by the intended recipient has received and processed the message; the term "processed" is understood to include presentation to a human user if appropriate <note>Therefore this specification does not distinguish between delivery and presentation, as was done in &xep0022;.</note> 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.</li>
<li>This condition is met if a message processing application (client) controlled by the intended recipient 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.</li>
<li>Although any defined action may be triggered, the only action needed in order to support message receipts is the "notify" action.</li>
</ul>
<p>The following is an example of a message that includes a request for return receipt.</p>
@ -191,7 +88,12 @@ S R
</amp>
</message>
]]></example>
<p>If the recipient supports Advanced Message Processing and the "receipt" rule, it MUST generate a receipt:</p>
<p>The recipient MUST generate a receipt if and only if it meets all of the following criteria:</p>
<ol>
<li>It supports Advanced Message Processing.</li>
<li>It supports the "receipt" rule.</li>
<li>It is configured to return receipts, either globally or for this recipient.</li>
</ol>
<example caption='A message receipt'><![CDATA[
<message
from='kingrichard@royalty.england.lit/throne'
@ -202,237 +104,16 @@ S R
</amp>
</message>
]]></example>
<p>If the recipient does not meet all of the foregoing criteria, it MUST NOT return a receipt and MUST NOT return an error.</p>
</section1>
<section1 topic='Business Rules' anchor='rules'>
<p>The general business rules specified for Advanced Message Processing in <cite>XEP-0079</cite> apply to any rule; in addition, the following business rules apply specifically to the receipt rule:</p>
<ol start='1'>
<li><p>A sender SHOULD NOT include a request for message receipts when sending a message to the bare JID (&BAREJID;) of the recipient, only when sending to a full JID (&FULLJID;).</p></li>
<li><p>A sender SHOULD NOT include a request for message receipts unless it knows (via &xep0030; or &xep0115;) that the intended recipient supports the protocol described herein or unless the use of message receipts is negotiated via &xep0155;.</p></li>
<li><p>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.</p></li>
<li><p>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.</p></li>
<li><p>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.</p></li>
<li><p>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.</p></li>
<li><p>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.</p></li>
</ol>
<p>Naturally, the receipt rule can be combined wiith rules specified in <cite>XEP-0079</cite> (e.g., the deliver rule) for more complete reporting.</p>
</section1>
<section1 topic='Protocol Flows' anchor='flow'>
<p>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.</p>
<section2 topic='Happy Path' anchor='flow-happy'>
<p>In the "happy path", the sender sends the message and the recipient returns a receipt within the sender's timeout period.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<example caption='A message receipt'><![CDATA[
<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>
]]></example>
</section2>
<section2 topic='Message Not Received' anchor='flow-messagenotreceived'>
<p>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.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<p>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.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<p>Now the message is received and the recipient returns a receipt.</p>
<example caption='A message receipt'><![CDATA[
<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>
]]></example>
</section2>
<section2 topic='Receipt Not Received' anchor='flow-receiptnotreceived'>
<p>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.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<p>The message is received and the recipient returns a receipt.</p>
<example caption='A message receipt'><![CDATA[
<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>
]]></example>
<p>The message receipt is not received by the sender within the sender's timeout period; therefore the sender resends the message.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<p>The resent message is received and the recipient returns a receipt, which is received by the sender within the sender's (second) timeout period.</p>
<example caption='A message receipt'><![CDATA[
<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>
]]></example>
</section2>
<section2 topic='Sender Goes Offline' anchor='flow-senderoffline'>
<p>In this scenario the sender sends the message but immediately goes offline. Therefore the recipient MUST NOT send a receipt.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<example caption='Sender goes offline'><![CDATA[
<presence
from='northumberland@shakespeare.lit/westminster'
to='kingrichard@royalty.england.lit/throne'
type='unavailable'/>
]]></example>
<p>The use case ends unsuccessfully, since the sender did not receive a receipt.</p>
</section2>
<section2 topic='Sender Goes Offline, Presence Not Received' anchor='flow-senderofflinenopres'>
<p>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.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<example caption='Sender goes offline'><![CDATA[
<presence
from='northumberland@shakespeare.lit/westminster'
type='unavailable'/>
]]></example>
<p>The recipient does not receive the presence unavailable so sends a message receipt.</p>
<example caption='A message receipt'><![CDATA[
<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>
]]></example>
<p>However, the sender does not receive the receipt within its timeout period (since it is now offline), so the use case ends unsuccessfully.</p>
</section2>
<section2 topic='Recipient Goes Offline' anchor='flow-recipientoffline'>
<p>In this scenario the sender sends the message but receives unavailable presence from the recipient before receiving a receipt within the timeout period.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<example caption='Recipient goes offline'><![CDATA[
<presence
from='kingrichard@royalty.england.lit/throne'
to='northumberland@shakespeare.lit/westminster'
type='unavailable'/>
]]></example>
<p>The use case ends unsuccessfully, since the sender did not receive a receipt.</p>
</section2>
<section2 topic='Recipient Goes Offline, Presence Not Received' anchor='flow-recipientofflinenopres'>
<p>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.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<example caption='Recipient goes offline'><![CDATA[
<presence
from='kingrichard@royalty.england.lit/throne'
type='unavailable'/>
]]></example>
<p>The sender does not receive the presence unavailable so sends a retry.</p>
<example caption='A message with receipt requested'><![CDATA[
<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>
]]></example>
<p>After sending some number of retries the sender gives up and the use case ends unsuccessfully.</p>
</section2>
</section1>
<section1 topic='Service Discovery' anchor='disco'>
<p>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 <cite>Entity Capabilities</cite> or directly via <cite>Service Discovery</cite>.</p>
<p>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 <cite>XEP-0079</cite>:</p>
@ -526,6 +207,9 @@ S R
</message>
]]></example>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
<p>Although a sender MAY attempt to resend a message if it knows that the recipient supports message receipts and it does not receive a reply within some configurable timeout period, resend logic is out of scope for this specification.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<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>
</section1>
@ -564,6 +248,6 @@ S R
</section2>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Joe Kemp for his input.</p>
<p>Thanks to Joe Kemp and Kevin Smith for their input.</p>
</section1>
</xep>