No Description
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-0022.xml 17KB

  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>Message Events</title>
  10. <abstract>This document defines an XMPP protocol extension used to request and respond to events relating to the delivery, display, and composition of messages. Note: This specification has been obsoleted in favor of XEP-0085 and XEP-0184.</abstract>
  12. <number>0022</number>
  13. <status>Obsolete</status>
  14. <type>Historical</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. </dependencies>
  19. <supersedes/>
  20. <supersededby>
  21. <spec>XEP-0085</spec>
  22. <spec>XEP-0184</spec>
  23. </supersededby>
  24. <shortname>x-event</shortname>
  25. <schemaloc>
  26. <url></url>
  27. </schemaloc>
  28. &jer;
  29. <author>
  30. <firstname>DJ</firstname>
  31. <surname>Adams</surname>
  32. <email></email>
  33. <jid></jid>
  34. </author>
  35. &stpeter;
  36. <revision>
  37. <version>1.4</version>
  38. <date>2009-05-27</date>
  39. <initials>psa</initials>
  40. <remark>Per a vote of the XMPP Council, changed status to Obsolete.</remark>
  41. </revision>
  42. <revision>
  43. <version>1.3</version>
  44. <date>2004-01-06</date>
  45. <initials>psa</initials>
  46. <remark>Added XML schema.</remark>
  47. </revision>
  48. <revision>
  49. <version>1.2</version>
  50. <date>2003-02-11</date>
  51. <initials>psa</initials>
  52. <remark>Attempted to clarify usage and business rules.</remark>
  53. </revision>
  54. <revision>
  55. <version>1.1</version>
  56. <date>2003-01-26</date>
  57. <initials>psa</initials>
  58. <remark>Added more detailed information and clarified a few points.</remark>
  59. </revision>
  60. <revision>
  61. <version>1.0</version>
  62. <date>2002-05-08</date>
  63. <initials>psa</initials>
  64. <remark>Changed status to Active.</remark>
  65. </revision>
  66. <revision>
  67. <version>0.2</version>
  68. <date>2002-03-13</date>
  69. <initials>dja</initials>
  70. <remark>Minor corrections and additions.</remark>
  71. </revision>
  72. <revision>
  73. <version>0.1</version>
  74. <date>2002-03-05</date>
  75. <initials>dja</initials>
  76. <remark>Initial draft.</remark>
  77. </revision>
  78. </header>
  79. <section1 topic='Introduction'>
  80. <p>The 'jabber:x:event' namespace defines extensions used to request and respond to events relating to the delivery, display, and composition of messages.</p>
  81. <p>By attaching a jabber:x:event extension to a &MESSAGE; element, the sender can track stages in the delivery of that message to its recipient.</p>
  82. <p><em>Note: More modern protocol extensions for this functionality have been defined in &xep0085; for the composing and offline events and in &xep0184; for the delivered and displayed events; those specifications supersede this one.</em></p>
  83. </section1>
  84. <section1 topic='The Events'>
  85. <p>There are four message events currently defined in this namespace:</p>
  86. <section2 topic='Offline'>
  87. <p>Indicates that the message has been stored offline by the intended recipient's server. This event is triggered only if the intended recipient's server supports offline storage, has that support enabled, and the recipient is offline when the server receives the message for delivery.</p>
  88. </section2>
  89. <section2 topic='Delivered'>
  90. <p>Indicates that the message has been delivered to the recipient. This signifies that the message has reached the recipient's Jabber client, but does not necessarily mean that the message has been displayed. This event is to be raised by the Jabber client.</p>
  91. </section2>
  92. <section2 topic='Displayed'>
  93. <p>Once the message has been received by the recipient's Jabber client, it may be displayed to the user. This event indicates that the message has been displayed, and is to be raised by the Jabber client. Even if a message is displayed multiple times, this event should be raised only once.</p>
  94. </section2>
  95. <section2 topic='Composing'>
  96. <p>In threaded chat conversations, this indicates that the recipient is composing a reply to a message. The event is to be raised by the recipient's Jabber client. A Jabber client is allowed to raise this event multiple times in response to the same request, providing the original event is cancelled first.</p>
  97. </section2>
  98. </section1>
  99. <section1 topic='Usage'>
  100. <p>Extensions qualified by the jabber:x:event namespace may be used only in the context of &MESSAGE; elements. That is, event information should be requested, and given in response, in relation to &MESSAGE; elements only, and not &PRESENCE; or &IQ; elements.</p>
  101. <p>Event information should only be sent in response to a request for that information. Unsolicited event information is illegal. In addition, a client should not request message event information from a correspondent if it is known (for example through the results of a previous browse request) that the correspondent does not support message events.</p>
  102. <p>Any request for the offline event in a message that has been stored offline must be removed by the server before the message is forwarded to the Jabber client. This means that any &lt;offline/&gt; tag should be removed from the extension.</p>
  103. <section2 topic='Requesting Event Notifications'>
  104. <p>Event notifications are requested by attaching an extension qualified by the jabber:x:event namespace to a &MESSAGE; element. A tag representing each event type requested for that message should be placed within the extension. Only one jabber:x:event extension may be attached to a &MESSAGE; element, but multiple event types may be requested within that one extension. The tags representing each of the event types are &lt;offline/&gt;, &lt;delivered/&gt;, &lt;displayed/&gt;, and &lt;composing/&gt;.</p>
  105. <p>An example of a &MESSAGE; element with a jabber:x:event extension is shown here.</p>
  106. <example caption='Requesting notification of offline storage and delivery for a message'><![CDATA[
  107. <message to='' id='message22'>
  108. <body>Art thou not Romeo, and a Montague?</body>
  109. <x xmlns='jabber:x:event'>
  110. <offline/>
  111. <delivered/>
  112. <composing/>
  113. </x>
  114. </message>
  115. ]]></example>
  116. <p>Here we see the sender wants to be notified if the message is stored offline (by the server), notified when the message is delivered (to the client), and notified if the recipient begins replying to the message. In this case, the sender will potentially receive three events based on this request. The first if the recipient is offline and the message is stored on the server, the second when the recipient becomes available and the message is delivered, and the third if the recipient begins composing a reply to the message.</p>
  117. <p>Note that the &MESSAGE; element requesting event notification contains an 'id' attribute. While these attributes are optional in the Jabber protocol, messages that contain event notification requests MUST contain an 'id' attribute so that raised events may be matched up with their original requests.</p>
  118. </section2>
  119. <section2 topic='Raising Events'>
  120. <p>If the message is stored by the server, the server must raise the requested event (offline) by sending a message to the sender as shown in this example:</p>
  121. <example caption='Raising the offline event'><![CDATA[
  122. <message
  123. from=''
  124. to=''>
  125. <x xmlns='jabber:x:event'>
  126. <offline/>
  127. <id>message22</id>
  128. </x>
  129. </message>
  130. ]]></example>
  131. <p>When raising an event, the raiser must send a &MESSAGE; element constructed according to the following rules:</p>
  132. <ul>
  133. <li>The element must contain only a jabber:x:event extension. Standard message elements such as &lt;subject/&gt;, &lt;body/&gt;, MUST NOT be included.</li>
  134. <li>The extension must contain one tag representing the event being raised. For example, if the offline event is being raised, an &lt;offline/> tag must be included. (The events are temporally exclusive, thus only one event tag should ever be included.)</li>
  135. <li>The extension must also contain an &lt;id/&gt; tag. The contents of this tag MUST be the value of the 'id' <em>attribute</em> of the original message to which this event notification pertains. (If no 'id' attribute was included in the original message, then the &lt;id/&gt; tag must still be included with no CDATA.)</li>
  136. <li>The message's from attribute should be set to the recipient of the original message for which the event is being raised. (This is an issue more relevant for the server, in responding to the offline event, because clients should rely on the server to stamp the elements that they send out with a from attribute.)</li>
  137. <li>The link between the original message for which the event is being raised, and the message containing that raised event, is the &lt;id/&gt; tag in the jabber:x:event extension of the message containing that raised event, that points to the id attribute of the original message.</li>
  138. </ul>
  139. </section2>
  140. <section2 topic='The Composing Event'>
  141. <p>The composing event is slightly different from the other events in that it can be raised and cancelled multiple times. This is to allow the reflection of what actually is happening when a user replies to a message; he may start composing a reply, which would trigger the composing event, get halfway through, and stop (by some definition of "stop", which may be implementation-specific). At this stage the event is no longer valid, or at least doesn't make much sense. So the client may send a cancellation for the composing event just raised.</p>
  142. <p>The cancellation is raised by sending another jabber:x:event; however, in contrast to how the events are usually raised, no &lt;composing/&gt; tag is sent, just an &lt;id/&gt; tag, like this:</p>
  143. <example caption='Romeo begins to compose a reply'><![CDATA[
  144. <message
  145. from=''
  146. to=''>
  147. <x xmlns='jabber:x:event'>
  148. <composing/>
  149. <id>message22</id>
  150. </x>
  151. </message>
  152. ]]></example>
  153. <example caption='Romeo pauses to reflect before answering, thus cancelling the composing event'><![CDATA[
  154. <message
  155. from=''
  156. to=''>
  157. <x xmlns='jabber:x:event'>
  158. <id>message22</id>
  159. </x>
  160. </message>
  161. ]]></example>
  162. <p>The lack of an &lt;composing/&gt; tag (and any other event tag) signifies that the composing event, indicated previously by the id value, has been cancelled. In this example, the composing event being cancelled is that event that was previously raised with the id of message22. After cancelling a composing event, a new one may be raised, following the same rules as before, when the typing of the reply is resumed.</p>
  163. </section2>
  164. </section1>
  165. <section1 topic='Examples'>
  166. <p>This section contains a number of examples to illustrate the full flow of messages, event notifications, and event cancellations for a fictional conversation.</p>
  167. <example caption='Juliet sends a message to Romeo and requests all event types'><![CDATA[
  168. SEND: <message to='' id='message22'>
  169. <body>Art thou not Romeo, and a Montague?</body>
  170. <x xmlns='jabber:x:event'>
  171. <offline/>
  172. <delivered/>
  173. <displayed/>
  174. <composing/>
  175. </x>
  176. </message>
  177. ]]></example>
  178. <p>Romeo temporarily loses his wireless connection in the Capulet's orchard and therefore his message is stored offline by the server, which generates the offline event and sends that notification to Juliet.</p>
  179. <example caption='Receiving the offline event'><![CDATA[
  180. RECV: <message
  181. from=''
  182. to=''>
  183. <x xmlns='jabber:x:event'>
  184. <offline/>
  185. <id>message22</id>
  186. </x>
  187. </message>
  188. ]]></example>
  189. <p>Romeo reconnects and the message is delivered to his Jabber client, which generates a delivered event and sends it to Juliet's client.</p>
  190. <example caption='Juliet receives notification of message delivery'><![CDATA[
  191. RECV: <message
  192. from=''
  193. to=''>
  194. <x xmlns='jabber:x:event'>
  195. <delivered/>
  196. <id>message22</id>
  197. </x>
  198. </message>
  199. ]]></example>
  200. <p>Romeo's Jabber client displays the message and sends a displayed event to Juliet's client.</p>
  201. <example caption='Juliet receives notification of message display'><![CDATA[
  202. RECV: <message
  203. from=''
  204. to=''>
  205. <x xmlns='jabber:x:event'>
  206. <displayed/>
  207. <id>message22</id>
  208. </x>
  209. </message>
  210. ]]></example>
  211. <p>Romeo begins composing a reply to Juliet's heartfelt question, and his Jabber client notifies Juliet that he is composing a reply.</p>
  212. <example caption='Juliet receives notification of message composing'><![CDATA[
  213. RECV: <message
  214. from=''
  215. to=''>
  216. <x xmlns='jabber:x:event'>
  217. <composing/>
  218. <id>message22</id>
  219. </x>
  220. </message>
  221. ]]></example>
  222. <p>Romeo realizes his reply is too rash and pauses to choose the right words; his Jabber client senses the delay and cancels the previous composing event.</p>
  223. <example caption='Juliet receives cancellation of message composing'><![CDATA[
  224. RECV: <message
  225. from=''
  226. to=''>
  227. <x xmlns='jabber:x:event'>
  228. <id>message22</id>
  229. </x>
  230. </message>
  231. ]]></example>
  232. <p>Romeo starts composing again, and his Jabber client sends a notification to Juliet's client.</p>
  233. <example caption='Juliet receives a second notification of message composing'><![CDATA[
  234. RECV: <message
  235. from=''
  236. to=''>
  237. <x xmlns='jabber:x:event'>
  238. <composing/>
  239. <id>message22</id>
  240. </x>
  241. </message>
  242. ]]></example>
  243. <p>Romeo finally sends his reply, and requests composing events related to it.</p>
  244. <example caption='Romeo replies'><![CDATA[
  245. SEND: <message to='' id='GabberMessage43'>
  246. <body>Neither, fair saint, if either thee dislike.</body>
  247. <x xmlns='jabber:x:event'>
  248. <composing/>
  249. </x>
  250. </message>
  251. ]]></example>
  252. </section1>
  253. <section1 topic='Implementation Notes'>
  254. <p>Compliant implementations SHOULD observe the following business rules:</p>
  255. <ol>
  256. <li>Every outgoing message sent from a compliant client should contain a request for event notifications (if such notifications are desired). The request for notifications cannot be sent just once in a conversation, since it applies to every message sent.</li>
  257. <li>When a client receives a request for events from another entity, it should cache the most recent ID.</li>
  258. <li>When a user begins replying to a message received from a contact, the user's client should check to see whether events have been requested by the contact for that message and set the CDATA of the &lt;id/&gt; element to the cached ID value.</li>
  259. <li>The CDATA of the &lt;id/&gt; element MUST be the same as the value of the 'id' attribute of the notification request.</li>
  260. </ol>
  261. </section1>
  262. <section1 topic='Security Considerations'>
  263. <p>There are no security features or concerns related to this proposal.</p>
  264. </section1>
  265. <section1 topic='IANA Considerations'>
  266. <p>This document requires no interaction with &IANA;.</p>
  267. </section1>
  268. <section1 topic='XMPP Registrar Considerations'>
  269. <p>No action on the part of the &REGISTRAR; is necessary as a result of this document, since 'jabber:x:event' is already a registered protocol namespace.</p>
  270. </section1>
  271. <section1 topic='XML Schema'>
  272. <code><![CDATA[
  273. <?xml version='1.0' encoding='UTF-8'?>
  274. <xs:schema
  275. xmlns:xs=''
  276. targetNamespace='jabber:x:event'
  277. xmlns='jabber:x:event'
  278. elementFormDefault='qualified'>
  279. <xs:annotation>
  280. <xs:documentation>
  281. The protocol documented by this schema is defined in
  282. XEP-0022:
  283. </xs:documentation>
  284. </xs:annotation>
  285. <xs:element name='x'>
  286. <xs:complexType>
  287. <xs:sequence>
  288. <xs:element name='offline' minOccurs='0' type='empty'/>
  289. <xs:element name='delivered' minOccurs='0' type='empty'/>
  290. <xs:element name='displayed' minOccurs='0' type='empty'/>
  291. <xs:element name='composing' minOccurs='0' type='empty'/>
  292. <xs:element name='id' minOccurs='0' type='xs:NMTOKEN'/>
  293. </xs:sequence>
  294. </xs:complexType>
  295. </xs:element>
  296. <xs:simpleType name='empty'>
  297. <xs:restriction base='xs:string'>
  298. <xs:enumeration value=''/>
  299. </xs:restriction>
  300. </xs:simpleType>
  301. </xs:schema>
  302. ]]></code>
  303. </section1>
  304. <section1 topic='Open Issues'>
  305. <ol>
  306. <li>In a Standards Track specification addressing event functionality, it would be desirable to have more cancellation methods for composing events than those defined in this Informational document. For instance, is someone still composing if they become unavailable? This example points to the fact that cancellation of a composing event can either be explicit (the default or desired scenario) or implicit (e.g., through a change in the availability state of a client or the existence of the session associated with the message composition).</li>
  307. </ol>
  308. </section1>
  309. </xep>