You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0333.xml 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Chat Markers</title>
  10. <abstract>This specification describes a solution of marking the last received, displayed and acknowledged message in a chat.</abstract>
  11. &LEGALNOTICE;
  12. <number>0333</number>
  13. <status>Deferred</status>
  14. <lastcall>2017-03-01</lastcall>
  15. <lastcall>2017-02-22</lastcall>
  16. <lastcall>2017-02-11</lastcall>
  17. <type>Standards Track</type>
  18. <sig>Standards</sig>
  19. <approver>Council</approver>
  20. <dependencies>
  21. <spec>XMPP Core</spec>
  22. <spec>XEP-0001</spec>
  23. </dependencies>
  24. <supersedes/>
  25. <supersededby/>
  26. <shortname>NOT_YET_ASSIGNED</shortname>
  27. <author>
  28. <firstname>Spencer</firstname>
  29. <surname>MacDonald</surname>
  30. <email>im@spencermacdonald.com</email>
  31. <jid>im@spencermacdonald.com</jid>
  32. </author>
  33. <revision>
  34. <version>0.3</version>
  35. <date>2017-09-11</date>
  36. <initials>XEP Editor (jwi)</initials>
  37. <remark>Defer due to lack of activity.</remark>
  38. </revision>
  39. <revision>
  40. <version>0.2.1</version>
  41. <date>2015-10-28</date>
  42. <initials>XEP Editor (mam)</initials>
  43. <remark><p>Fixing typo ("cannot" repeated twice) (JC Brand).</p></remark>
  44. </revision>
  45. <revision>
  46. <version>0.2</version>
  47. <date>2013-09-05</date>
  48. <initials>sdm</initials>
  49. <remark><p>Moved Thread outside of the Chat Marker.</p></remark>
  50. </revision>
  51. <revision>
  52. <version>0.1</version>
  53. <date>2013-07-11</date>
  54. <initials>psa</initials>
  55. <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  56. </revision>
  57. <revision>
  58. <version>0.0.4</version>
  59. <date>2013-07-06</date>
  60. <initials>sdm</initials>
  61. <remark>
  62. <p>Noted that Chat Markers is a heuristic solution.</p>
  63. <p>Added markable element.</p>
  64. </remark>
  65. </revision>
  66. <revision>
  67. <version>0.0.3</version>
  68. <date>2013-06-20</date>
  69. <initials>sdm</initials>
  70. <remark>
  71. <p>Changed read Chat Marker to displayed.</p>
  72. <p>Removed stamp from Chat Marker.</p>
  73. <p>Added thread to Chat Marker.</p>
  74. <p>Changed namespace to allow for versioning.</p>
  75. </remark>
  76. </revision>
  77. <revision>
  78. <version>0.0.2</version>
  79. <date>2013-06-11</date>
  80. <initials>sdm</initials>
  81. <remark><p>Change to a message based protocol.</p></remark>
  82. </revision>
  83. <revision>
  84. <version>0.0.1</version>
  85. <date>2013-05-24</date>
  86. <initials>sdm</initials>
  87. <remark><p>First draft.</p></remark>
  88. </revision>
  89. </header>
  90. <section1 topic='Introduction' anchor='intro'>
  91. <p>The concept of delivery and read receipts has been popularised by other messaging services such as iMessage, Google Hangouts and Blackberry Messenger.
  92. 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.
  93. These visual indications (referred to herein as "Chat Markers") are synced between all of the sender's
  94. and recipient's resources automatically, so the state of a chat is always consistent.
  95. If one or more of the resources is not connected, it can fetch Chat Markers from the Message Archive upon reconnecting.</p>
  96. <p>&xep0184; currently provides delivery receipts on a per message basis,
  97. but it does not provide any mechanism for the user to indicate that they have read or acknowledged the message.
  98. As delivery receipts are sent on a per message basis it would require multiple messages to "sync up" up delivery receipts between resources.</p>
  99. <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>
  100. <p>This XEP outlines an efficient message based protocol to provide this functionally using Chat Markers.</p>
  101. <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>
  102. </section1>
  103. <section1 topic='Terminology' anchor='terms'>
  104. <p>The term "active chat" refers to a chat that a user is currently active in. See &xep0085;.</p>
  105. <p>The term "system notification" refers to a notification (typically a preview) that is displayed separately to a Chat.</p>
  106. <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>
  107. <p>The term "markable message" refers to the stanza for which the original sender would like to receive a Chat Marker.</p>
  108. <p>The term "Chat Marker" refers to the stanza by which the recipient replies to a "markable message" with a marker.</p>
  109. </section1>
  110. <section1 topic='Requirements' anchor='reqs'>
  111. <p>This document addresses the following requirements:</p>
  112. <ol>
  113. <li>Enable a client to mark a message as markable.</li>
  114. <li>Enable a client to mark the last received message in a chat.</li>
  115. <li>Enable a client to mark the last displayed message in a chat.</li>
  116. <li>Enable a client to mark the last acknowledged message in a chat.</li>
  117. <li>Enable a client to fetch and set Chat Markers regardless of wether the other users in a chat are online.</li>
  118. </ol>
  119. </section1>
  120. <section1 topic='Determining support' anchor='disco'>
  121. <p>If an entity supports the Chat Markers protocol, it MUST report that by including a &xep0030;
  122. feature of "urn:xmpp:chat-markers:0" in response to disco#info requests:</p>
  123. <example caption='Client queries for server features'>
  124. <![CDATA[
  125. <iq type='get' id='disco1' to='capulet.lit' from='juliet@capulet.lit/balcony'>
  126. <query xmlns='http://jabber.org/protocol/disco#info'/>
  127. </iq>
  128. ]]>
  129. </example>
  130. <example caption='Entity responds with features'>
  131. <![CDATA[
  132. <iq type='result' id='disco1' from='capulet.lit' to='juliet@capulet.lit/balcony'>
  133. <query xmlns='http://jabber.org/protocol/disco#info'>
  134. ...
  135. <feature var='urn:xmpp:chat-markers:0'/>
  136. ...
  137. </query>
  138. </iq>
  139. ]]>
  140. </example>
  141. <p>Support can also be determined via &xep0115;, a.k.a. "caps".</p>
  142. </section1>
  143. <section1 topic='When to send Chat Markers and markable messages' anchor='when'>
  144. <section2 topic='Bare JID' anchor='when-bare'>
  145. <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>
  146. </section2>
  147. <section2 topic='Full JID' anchor='when-full'>
  148. <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>
  149. <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>
  150. <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>
  151. </section2>
  152. <section2 topic='Chat Marker' anchor='when-chat-marker'>
  153. <p>To prevent looping, an entity MUST NOT send a Chat Maker to mark up to a Chat Marker.</p>
  154. </section2>
  155. </section1>
  156. <section1 topic='Protocol Format' anchor='format'>
  157. <p>Chat Markers use a dedicated protocol extension qualified by the 'urn:xmpp:chat-markers:0' namespace.</p>
  158. <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>
  159. <p>The 3 other allowable elements in this namespace are used to mark a message (in order of significance):</p>
  160. <ul>
  161. <li>received -- the message has been received by a client.</li>
  162. <li>displayed -- the message has been displayed to a user in a active chat and not in a system notification.</li>
  163. <li>acknowledged -- the message has been acknowledged by some user interaction e.g. pressing an acknowledgement button.</li>
  164. </ul>
  165. <p>The Chat Marker MUST have an 'id' which is the 'id' of the message being marked.</p>
  166. <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>
  167. <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>
  168. <example caption='Example Content Message with a markable Chat Marker'>
  169. <![CDATA[
  170. <message
  171. from='northumberland@shakespeare.lit/westminster'
  172. id='message-1'
  173. to='kingrichard@royalty.england.lit/throne'>
  174. <thread>sleeping</thread>
  175. <body>My lord, dispatch; read o'er these articles.</body>
  176. <markable xmlns='urn:xmpp:chat-markers:0'/>
  177. </message>
  178. ]]>
  179. </example>
  180. <p class='box'>Note: A sender MUST include an 'id' attribute on every markable message.</p>
  181. <p>If recipient does not support the Chat Markers protocol it SHOULD NOT return an error.</p>
  182. <example caption='Example Message marked with a recieved Chat Marker'>
  183. <![CDATA[
  184. <message
  185. from='kingrichard@royalty.england.lit/throne'
  186. id='message-2'
  187. to='northumberland@shakespeare.lit/westminster'>
  188. <thread>sleeping</thread>
  189. <received xmlns='urn:xmpp:chat-markers:0'
  190. id='message-1'/>
  191. </message>
  192. ]]>
  193. </example>
  194. <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>
  195. </section1>
  196. <section1 topic='Requirements' anchor='requirements'>
  197. <p>Clients SHOULD use &xep0280; to support multiple online resources.</p>
  198. <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>
  199. <p>Messages MUST have an 'id' to use Chat Markers.</p>
  200. <p>Messages MUST include the 'markable' element to use Chat Markers.</p>
  201. <p>Chat Markers MUST only move forward. If a Chat Maker is received for an earlier message than the current Chat Marker, it MUST be ignored by the client.
  202. </p>
  203. <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.
  204. </p>
  205. </section1>
  206. <section1 topic='Business Rules' anchor='rules'>
  207. <section2 topic='Optimizations' anchor='chatstates'>
  208. <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,
  209. a received Chat Marker should only be sent if it has a later timestamp than the displayed Chat Marker.</p>
  210. <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>
  211. <p>Only Messages that can be displayed in a chat SHOULD be markable.</p>
  212. </section2>
  213. <section2 topic='Never Auto Acknowledge' anchor='never-auto-acknowledge'>
  214. <p>Clients MUST NOT mark a message as acknowledged without any user interaction.</p>
  215. </section2>
  216. <section2 topic='Marking Sent Messages' anchor='marking-sent-messages'>
  217. <p>Clients MAY mark a sent or received message, as Chat Markers are inclusive of of both previously sent and received messages.</p>
  218. </section2>
  219. <section2 topic='Interaction with Delivery Receipts' anchor='receipts'>
  220. <p>Chat Markers MAY be used alongside Delivery Receipts.</p>
  221. </section2>
  222. <section2 topic='Interaction with Chat States' anchor='chatstates'>
  223. <p>Chat Markers MAY be used alongside Chat States.</p>
  224. </section2>
  225. </section1>
  226. <section1 topic='Security Considerations' anchor='security'>
  227. <p>A user may not wish to disclose that they have received, displayed or acknowledge a message.</p>
  228. <p>It is possible for a sender to leak its presence when updating Chat Markers;
  229. therefore, a sender SHOULD NOT send Chat Markers to recipients who are not otherwise authorized to view its presence.</p>
  230. </section1>
  231. <section1 topic='IANA Considerations' anchor='iana'>
  232. <p>This document requires no interaction with the Internet Assigned Numbers Authority (IANA).</p>
  233. </section1>
  234. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  235. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  236. <p>This specification defines the following XML namespace:</p>
  237. <ul>
  238. <li>'urn:xmpp:chat-markers:0'</li>
  239. </ul>
  240. </section2>
  241. </section1>
  242. <section1 topic='XML Schema' anchor='schema'>
  243. <code>
  244. <![CDATA[
  245. <?xml version='1.0' encoding='UTF-8'?>
  246. <xs:schema attributeFormDefault="unqualified"
  247. elementFormDefault="qualified"
  248. targetNamespace="urn:xmpp:chat-markers:0"
  249. xmlns:xs="http://www.w3.org/2001/XMLSchema">
  250. <xs:annotation>
  251. <xs:documentation>
  252. The protocol documented by this schema is defined in
  253. XEP-0333: http://xmpp.org/extensions/xep-0333.html
  254. </xs:documentation>
  255. </xs:annotation>
  256. <xs:element name="markable">
  257. <xs:complexType>
  258. <xs:simpleContent>
  259. <xs:extension base="xs:string">
  260. </xs:extension>
  261. </xs:simpleContent>
  262. </xs:complexType>
  263. </xs:element>
  264. <xs:element name="received">
  265. <xs:complexType>
  266. <xs:simpleContent>
  267. <xs:extension base="xs:string">
  268. <xs:attribute type="xs:string" name="id"/>
  269. </xs:extension>
  270. </xs:simpleContent>
  271. </xs:complexType>
  272. </xs:element>
  273. <xs:element name="displayed">
  274. <xs:complexType>
  275. <xs:simpleContent>
  276. <xs:extension base="xs:string">
  277. <xs:attribute type="xs:string" name="id"/>
  278. </xs:extension>
  279. </xs:simpleContent>
  280. </xs:complexType>
  281. </xs:element>
  282. <xs:element name="acknowledged">
  283. <xs:complexType>
  284. <xs:simpleContent>
  285. <xs:extension base="xs:string">
  286. <xs:attribute type="xs:string" name="id"/>
  287. </xs:extension>
  288. </xs:simpleContent>
  289. </xs:complexType>
  290. </xs:element>
  291. </xs:schema>
  292. ]]>
  293. </code>
  294. </section1>
  295. </xep>