Skip to content

Commit

Permalink
XEP-0333: Display Markers. Remove received and ack
Browse files Browse the repository at this point in the history
  • Loading branch information
iNPUTmice committed Mar 10, 2024
1 parent caa1e57 commit 739f759
Showing 1 changed file with 82 additions and 172 deletions.
254 changes: 82 additions & 172 deletions xep-0333.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Chat Markers</title>
<abstract>This specification describes a solution of marking the last received, displayed and acknowledged message in a chat.</abstract>
<title>Displayed Markers (was: Chat Markers)</title>
<abstract>This specification introduces a method to let the sender, or multiple participants in a group chat, know that a client has displayed messages up to a certain point.</abstract>
&LEGALNOTICE;
<number>0333</number>
<status>Deferred</status>
<status>Experimental</status>
<lastcall>2017-03-01</lastcall>
<lastcall>2017-02-22</lastcall>
<lastcall>2017-02-11</lastcall>
Expand All @@ -30,6 +30,24 @@
<email>[email protected]</email>
<jid>[email protected]</jid>
</author>
<author>
<firstname>Daniel</firstname>
<surname>Gultsch</surname>
<email>[email protected]</email>
<jid>[email protected]</jid>
</author>
<revision>
<version>0.5.0</version>
<date>2024-03-06</date>
<initials>dg</initials>
<remark>
<ul>
<li>Remove &lt;received/> to not replicate &xep0184; functionality.</li>
<li>Remove &lt;acknowledged/> because it was not implemented in the last 10 years and apparently is not needed.</li>
<li>Remove Disco feature. Opting in via &lt;markable/> is enough</li>
</ul>
</remark>
</revision>
<revision>
<version>0.4.1</version>
<date>2023-07-19</date>
Expand Down Expand Up @@ -100,170 +118,59 @@
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>The concept of delivery and read receipts has been popularised by other messaging services such as iMessage, Google Hangouts and Blackberry Messenger.
These services provide a visual indication of when a message has been delivered to any of the recipients resources and (optionally) when it has been read.
These visual indications (referred to herein as "Chat Markers") are synced between all of the sender's
and recipient's resources automatically, so the state of a chat is always consistent.
If one or more of the resources is not connected, it can fetch Chat Markers from the Message Archive upon reconnecting.</p>
<p>&xep0184; currently provides delivery receipts on a per message basis,
but it does not provide any mechanism for the user to indicate that they have read or acknowledged the message.
As delivery receipts are sent on a per message basis it would require multiple messages to "sync up" up delivery receipts between resources.</p>
<p>Moreover by using &xep0085; you could infer that a message has been read by the recipient, if they become active at any point after the message has been delivered, but again it would require multiple messages to "sync up" chat states between resources.</p>
<p>This XEP outlines an efficient message based protocol to provide this functionally using Chat Markers.</p>
<p class='box'><em>Note: Chat Markers do not mark each individual message, nor do they assume a reliable transport. This means that Chat Markers can only provide a heuristic solution, but this is often satisfactory for the majority of use cases.</em></p>
</section1>

<section1 topic='Terminology' anchor='terms'>
<p>The term "active chat" refers to a chat that a user is currently active in. See &xep0085;.</p>
<p>The term "system notification" refers to a notification (typically a preview) that is displayed separately to a Chat.</p>
<p>The term "read" in the context of iMessage, Google Hangouts and Blackberry Messenger, directly maps to the displayed element in the Chat Marker namespace.</p>
<p>The term "markable message" refers to the stanza for which the original sender would like to receive a Chat Marker.</p>
<p>The term "Chat Marker" refers to the stanza by which the recipient replies to a "markable message" with a marker.</p>
<p>Letting the sender and/or multiple participants of a group chat know that an entity has displayed (Colloquially known as <em>read</em>) a message is a common feature in modern instant messaging.</p>
<p>&xep0184; currently provides delivery receipts on a per message basis, but it does not provide any mechanism for the user to indicate that they have read the message.</p>
<p>This specification defines a protocol for the sender of a message to let the recipient know they are interested in whether the recipient’s client has displayed the message and a protocol for the recipient to respond to said request. In group chats the explicit request is omitted and participants opportunistically share their displayed state with others.</p>
<p>Displayed Markers carry a semantic of <em>all messages up to this point</em>.</p>
<p class='box'>Note: Displayed Markers do not mark each individual message, nor do they assume a reliable transport. This means that Displayed Markers can only provide a heuristic solution, but this is often satisfactory for the majority of use cases.</p>
</section1>

<section1 topic='Requirements' anchor='reqs'>
<p>This document addresses the following requirements:</p>
<ol>
<li>Enable a client to mark a message as markable.</li>
<li>Enable a client to mark the last received message in a chat.</li>
<li>Enable a client to mark the last displayed message in a chat.</li>
<li>Enable a client to mark the last acknowledged message in a chat.</li>
<li>Enable a client to fetch and set Chat Markers regardless of wether the other users in a chat are online.</li>
</ol>
</section1>

<section1 topic='Determining support' anchor='disco'>
<p>If an entity supports the Chat Markers protocol, it MUST report that by including a &xep0030;
feature of "urn:xmpp:chat-markers:0" in response to disco#info requests:</p>
<example caption='Client queries for features'>
<![CDATA[
<iq type='get' id='disco1' to='[email protected]/mobile' from='[email protected]/balcony'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]>
</example>

<example caption='Entity responds with features'>
<![CDATA[
<iq type='result' id='disco1' from='[email protected]/mobile' to='[email protected]/balcony'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:chat-markers:0'/>
...
</query>
</iq>
]]>
</example>

<p>Support can also be determined via &xep0115;, a.k.a. "caps".</p>
</section1>

<section1 topic='When to send Chat Markers and markable messages' anchor='when'>
<section2 topic='Bare JID' anchor='when-bare'>
<p>If the sender knows only the recipient's bare JID, it cannot determine (via &xep0030; or &xep0115;) whether the intended recipient supports the Chat Markers protocol. In this case, the sender MAY send a Chat Marker or markable message.</p>
</section2>
<section2 topic='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 service disco or entity capabilities) whether the client at that full JID supports the Chat Markers protocol before attempting to send a Chat Marker or markable message.</p>
<p>If the sender determines that the recipient's client does not support the Chat Markers protocol then it SHOULD NOT send Chat Markers or markable messages.</p>
<p>If the sender determines that the recipient's client supports the Chat Markers protocol then it MAY send a Chat Marker or markable message to that full JID.</p>
</section2>
<section2 topic='Chat Marker' anchor='when-chat-marker'>
<p>To prevent looping, an entity MUST NOT send a Chat Marker to mark up to a Chat Marker.</p>
</section2>
</section1>

<section1 topic='Protocol Format' anchor='format'>
<p>Chat Markers use a dedicated protocol extension qualified by the 'urn:xmpp:chat-markers:0' namespace.</p>
<p>There are 4 allowable elements in the namespace, the first 'markable' indicates that a message can be marked with a Chat Marker and is therefore a "markable message".</p>
<p>The 3 other allowable elements in this namespace are used to mark a message (in order of significance):</p>
<ul>
<li>received -- the message has been received by a client.</li>
<li>displayed -- the message has been displayed to a user in a active chat and not in a system notification.</li>
<li>acknowledged -- the message has been acknowledged by some user interaction e.g. pressing an acknowledgement button.</li>
<li>Enable a client to mark the last displayed message in a chat.</li>
<li>Enable a client to fetch and set Displayed Markers regardless of whether the other users in a chat are online.</li>
<li>Do not replicate functionality of &xep0184;</li>
<li>Do not be concerned about displayed state synchronization across multiple devices of the same user</li>
</ul>
</section1>

<p>The Chat Marker MUST have an 'id' which is the 'id' of the message being marked.</p>
<p>The Chat Marker message stanza MUST have a 'thread' child element if the message has been received, displayed or acknowledged in the context of a thread.</p>
<p>A Chat Marker Indicates that all messages up to and including that message 'id' have been marked. If a thread is supplied, a Chat Marker is only valid in the context of that thread.</p>

<example caption='Example Content Message with a markable Chat Marker'>
<![CDATA[
<message
from='[email protected]/westminster'
id='message-1'
to='[email protected]/throne'>
<thread>sleeping</thread>
<body>My lord, dispatch; read o'er these articles.</body>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic='Requesting Displayed Markers' anchor='request'>
<p>An entity interested to know if the recipient has displayed a message attaches a &lt;markable/> element qualified by the 'urn:xmpp:chat-markers:0' namespace to the message. The message MUST possess an 'id' attribute for traceability.</p>
<example caption="Romeo sends a message to Juliet"><![CDATA[
<message to='[email protected]' from='[email protected]/orchard' id='the-msg-1'>
<body>Hi. How are you?</body>
<markable xmlns='urn:xmpp:chat-markers:0'/>
<request xmlns='urn:xmpp:receipts'/>
</message>
]]>
</example>

<p class='box'>Note: A sender MUST include an 'id' attribute on every markable message.</p>

<p>If recipient does not support the Chat Markers protocol it SHOULD NOT return an error.</p>

<example caption='Example Message marked with a recieved Chat Marker'>
<![CDATA[
<message
from='[email protected]/throne'
id='message-2'
to='[email protected]/westminster'>
<thread>sleeping</thread>
<received xmlns='urn:xmpp:chat-markers:0'
id='message-1'/>
</message>
]]>
</example>
<p>When the recipient sends a Chat Marker, it SHOULD ensure that the message stanza contains only the Chat Marker child element and optionally (when appropriate) a thread child element. Naturally, intermediate entities might add other extension elements to the message when routing or delivering the receipt message, e.g., a &lt;delay/&gt; element as specified in &xep0203;.</p>
</section1>

<section1 topic='Requirements' anchor='requirements'>
<p>Clients SHOULD use &xep0280; to support multiple online resources.</p>
<p>Clients SHOULD use &xep0136; or &xep0313; to support offline updating of Chat Markers. Chat Markers SHOULD be archived, so they can be fetched and set regardless of whether the other users in a chat are online.</p>
<p>Messages MUST have an 'id' to use Chat Markers.</p>
<p>Messages MUST include the 'markable' element to use Chat Markers.</p>
<p>Chat Markers MUST only move forward. If a Chat Marker is received for an earlier message than the current Chat Marker, it MUST be ignored by the client.
</p>
<p>Chat Markers for unknown messages MUST be ignored by the client. A client MAY store the Chat Marker incase the associated message is retrieved later.
</p>
</section1>

<section1 topic='Business Rules' anchor='rules'>
<section2 topic='Optimizations' anchor='chatstates'>
<p>Less Significant Chat Markers SHOULD only be sent if they are later than the more significant Chat Marker i.e. if a Message has been marked as displayed,
a received Chat Marker should only be sent if it has a later timestamp than the displayed Chat Marker.</p>
<p>To avoid sending redundant Chat Markers while retrieving archived messages, Chat Markers SHOULD only be sent after retrieving the most recent message for a chat.</p>
<p>Only Messages that can be displayed in a chat SHOULD be markable.</p>
</section2>
<section2 topic='Never Auto Acknowledge' anchor='never-auto-acknowledge'>
<p>Clients MUST NOT mark a message as acknowledged without any user interaction.</p>
</section2>
<section2 topic='Marking Sent Messages' anchor='marking-sent-messages'>
<p>Clients MAY mark a sent or received message, as Chat Markers are inclusive of of both previously sent and received messages.</p>
</section2>
<section2 topic='Interaction with Delivery Receipts' anchor='receipts'>
<p>Chat Markers MAY be used alongside Delivery Receipts.</p>
]]></example>
</section2>
<section2 topic='Interaction with Chat States' anchor='chatstates'>
<p>Chat Markers MAY be used alongside Chat States.</p>
<section2 topic='Sending Displayed Markers' anchor='sending'>
<p>To let the sender know a message has been displayed an entity sends a message with a &lt;displayed/> element qualified by the 'urn:xmpp:chat-markers:0' namespace. The &lt;displayed/> element MUST have an 'id' attribute that copies the value from the 'id' attribute of the message it refers to.</p>
<p>A Displayed Marker MAY be sent to the bare JID of the entity that requested it.</p>
<p>If multiple messages are displayed at once an entity SHOULD only send a &lt;displayed/> marker for the most recent, received message.</p>
<p>To prevent looping, an entity MUST NOT send a Displayed Marker as a response to a Displayed Marker.</p>
<example caption="Juliet lets both Romeo she has displayed the message"><![CDATA[
<message to='[email protected]' from='[email protected]/balcony'>
<displayed xmlns='urn:xmpp:chat-markers:0' id='the-msg-1'/>
</message>
]]></example>
</section2>
<section2 topic='Usage within MUC' anchor='rules-muc'>
<p>Markers may be used within a MUC to indicate read status of each occupant.</p>
<section2 topic='Group Chats' anchor='groups'>
<p>Displayed Markers can be used within group chats to indicate read status of each occupant.</p>
<p>Within the context of a MUC messages are relayed through the MUC's own JID. In a
MUC that preserves the 'id' attribute chosen by the sender of the message this
'id' attribute cannot be considered unique, as it may be unintentionally or
even maliciously reused by another MUC occupant.</p>

<p>Therefore, if a MUC announces support for &xep0359; then clients MUST always use
the MUC-assigned id for Chat Markers. The id will be contained in a &lt;stanza-id/&gt;
the MUC-assigned id for Displayed Markers. The id will be contained in a &lt;stanza-id/&gt;
element inserted into the stanza with a 'by' attribute matching the MUC's own JID.</p>

<p>As per XEP-0359 security considerations, if XEP-0359 support is not announced on the
MUC room's JID then &lt;stanza-id/&gt; elements with a 'by' attribute that match the
MUC's JID should be considered spoofed and MUST be ignored.</p>
<p>In group chats the Displayed Marker MAY be sent opportunistically, meaning without an explicit &lt;markable/> request from the sender. While the sender might not be interested in or have support for Display Markers, other participants of the group chat could be interested in them.</p>

<example caption='Example MUC message with a markable Chat Marker'>
<example caption='Example MUC message with a markable Displayed Marker'>
<![CDATA[
<message
from='[email protected]/firstwitch'
Expand Down Expand Up @@ -291,18 +198,37 @@
</message>
]]>
</example>

</section2>
</section1>

<section1 topic='Business Rules' anchor='rules'>
<ul>
<li>Displayed Marker only move forward. Receiving a Display Marker with an id-attribute that references a message older than the current local representation is considered redundant and MUST be ignored.</li>
<li>Displayed Marker with an id-attribute that references a message not found in the respective chat MUST be ignored.</li>
<li>Entities MUST not sent Displayed Markers for outgoing messages that were sent by the same or a different resource of the same entity (received for example via &xep0280; or &xep0313;).</li>
</ul>
</section1>

<section1 topic='Accessibility Considerations' anchor='access'>
<p>Graphical representations of displayed markers for example in the form of checkmarks need to be made available for visually impaired users.</p>
</section1>

<section1 topic='Security Considerations' anchor='security'>
<p>A user may not wish to disclose that they have received, displayed or acknowledge a message.</p>
<p>It is possible for a sender to leak its presence when updating Chat Markers;
therefore, a sender SHOULD NOT send Chat Markers to recipients who are not otherwise authorized to view its presence.</p>
<ul>
<li>A user may not wish to disclose that they have displayed or acknowledge a message.</li>
<li>It is possible for a sender to leak its presence when updating Displayed Markers; therefore, a sender SHOULD NOT send Displayed Markers to recipients who are not otherwise authorized to view its presence.</li>
<li>To accurately and reliably match Displayed Markers to current participants of a group chat, implementations MUST use the real JID (when available, for example in non-anonymous MUCs) or &xep0421;.</li>
</ul>
</section1>

<section1 topic='Privacy Considerations' anchor='privacy'>
<p>Letting others know that one has displayed (read) a message is not a desirable feature for everyone. Clients SHOULD provide ways to opt-out of this feature.</p>
</section1>

<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with the Internet Assigned Numbers Authority (IANA).</p>
</section1>

<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>This specification defines the following XML namespace:</p>
Expand All @@ -311,6 +237,11 @@
</ul>
</section2>
</section1>

<section1 topic='Design Considerations' anchor='design'>
<p>Earlier drafts of this specification included &lt;received/> and &lt;acknowledged/> with the same <em>up to this point</em> semantic as the remaining &lt;displayed/>. However in the review phase it was concluded that most implementers prefer the per-message precision of &xep0184; for received tracking. While &lt;displayed/> has been widely implemented during a 10+ year review phase there was seemingly no demand for &lt;acknowledged/>.</p>
</section1>

<section1 topic='XML Schema' anchor='schema'>
<code>
<![CDATA[
Expand All @@ -337,16 +268,6 @@
</xs:complexType>
</xs:element>
<xs:element name="received">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="id"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="displayed">
<xs:complexType>
<xs:simpleContent>
Expand All @@ -357,17 +278,6 @@
</xs:complexType>
</xs:element>
<xs:element name="acknowledged">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="id"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
]]>
</code>
Expand Down

0 comments on commit 739f759

Please sign in to comment.