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.

  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>Jabber Event Notification Service (ENS)</title>
  10. <abstract>A generic publish-and-subscribe service for Jabber.</abstract>
  12. <number>0021</number>
  13. <status>Retracted</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies/>
  17. <supersedes/>
  18. <supersededby><spec>XEP-0060</spec></supersededby>
  19. <shortname>None</shortname>
  20. <author>
  21. <firstname>Robert</firstname>
  22. <surname>Norris</surname>
  23. <email></email>
  24. <jid></jid>
  25. </author>
  26. <revision>
  27. <version>0.2</version>
  28. <date>2003-04-22</date>
  29. <initials>psa</initials>
  30. <remark>At the request of the author, the status of this document has been changed to Retracted since it has been superseded by XEP-0060.</remark>
  31. </revision>
  32. <revision>
  33. <version>0.1</version>
  34. <date>2002-03-04</date>
  35. <initials>rn</initials>
  36. <remark>Initial version</remark>
  37. </revision>
  38. </header>
  39. <section1 topic='Introduction'>
  40. <p>The Jabber Event Notification Service (ENS) acts as a dispatcher and may be used by applications as a central point of collection for certain types of events that are of interest to them. Examples of events include:</p>
  41. <ul>
  42. <li>User has logged in</li>
  43. <li>A new message has arrived</li>
  44. <li>User's avatar has changed</li>
  45. <li>The coffee machine is empty</li>
  46. </ul>
  47. <p>In Jabber, the role of the ENS has traditionally been filled by overloading the &lt;presence/&gt; packet type. However, this method was never designed to be used as a general publish-and-subscribe mechanism, and so has the following problems:</p>
  48. <ul>
  49. <li>Dispatching of &lt;presence/&gt; packets is performed by the JSM (Jabber Session Manager), and so is not easily usable by components and other entities that don't connect via a client manager (c2s, CCM).</li>
  50. <li>An entity cannot subscribe to the presence of a specific resource of another entity, only to any presence from that entity. This lack of granularity makes its difficult to use &lt;presence/&gt; in situations where large chunks of data must be dispatched to subscribers (eg avatars).</li>
  51. </ul>
  52. <p>The protocol consists of two parts - the subscriber-to-ENS protocol, and the publisher-to-ENS protocol. Since there is no direct interaction between a publisher and a subscriber, it makes sense to seperate the two parts of the protocol.</p>
  53. <p>The protocol operates in the '' namespace.</p>
  54. <p>A reference implementation was formerly available at</p>
  55. </section1>
  56. <section1 topic='Definitions'>
  57. <p>Before we begin describing the protocol, is it necessary to define some terms, including the function and responsibilties of the entities that communicate with the ENS.</p>
  58. <section2 topic='Event'>
  59. <p>An event can be defined as a change to the value of one or more properties of a resource.</p>
  60. <p>In the ENS, an event type is referred to by a JID (Jabber IDentifier), including the JID resource. For example, consider a hypothetical publisher that is linked to an IMAP message store. It might notify the ENS of the fact the a message has arrived, deleted, or filed, using the following JIDs:</p>
  61. <ul>
  62. <li></li>
  63. <li></li>
  64. <li></li>
  65. </ul>
  66. <p>Alternatively, an end-user client that wanted to notify the ENS when its avatar changes might do so using a JID like &quot;;</p>
  67. </section2>
  68. <section2 topic='Subscriber'>
  69. <p>A subscriber is a Jabber entity that receives notifications about events. Usually, a subscriber will be an end-user client, but it may be any Jabber entity.</p>
  70. <p>As the name suggests, a subscriber can subscribe and unsubscribe to various events via the ENS. When it subscribes, the publisher responsible for the event it is subscribing to will be asked by the ENS to authorise the subscription request. To facilitate this, the subscriber may provide an XML fragment containing information that the publisher can use to authorise it. The use of this fragment is application specific.
  71. </p>
  72. <p>Once subscribed to an event, the subscriber will receive any notifications that the publisher sends about that event.</p>
  73. </section2>
  74. <section2 topic='Publisher'>
  75. <p>A publisher is the Jabber entity responsible for actually sending event notifications to the ENS. A notification contains the event type JID of the event that occured, and an optional &quot;payload&quot; XML fragment, that is passed untouched by the ENS to the subscriber. The contents of this payload is application-specific and can be used to provide detailed information about the event to the subscriber. For example, in the case of the NewMessage event above, the payload might contain the contents of the To:, From: and Subject: headers of the message.</p>
  76. <p>Additionally, the publisher is responsible for deciding who may subscribe to events it publishes. When the ENS receives a subscription request, it will ask the publisher to decide whether or not the subscriber may subscribe to a particular event. This authorisation request may also contain an XML fragment from the subscriber containing information that may be used for authorisation.</p>
  77. </section2>
  78. </section1>
  79. <section1 topic='Subscriber protocol'>
  80. <section2 topic='Subscription request'>
  81. <p>To subscribe to a particular event, the subscriber sends a packet like of the following form to the ENS:</p>
  82. <example caption='Subscription request'>
  83. &lt;iq id='sub1' type='set' from='subscriber-jid' to='ens-jid'&gt;
  84. &lt;subscribe xmlns='' jid='event-jid'/&gt;
  85. &lt;/iq&gt;
  86. </example>
  87. <section3 topic='Option: &lt;auth-info/&gt;'>
  88. <p>The subscriber may include an &lt;auth-info/&gt; XML fragment containing some (application-specific) information that the publisher can use to authorise it:</p>
  89. <example caption='Subscription request with authorisation information'>
  90. &lt;iq id='sub2' type='set' from='subscriber-jid' to='ens-jid'&gt;
  91. &lt;subscribe xmlns='' jid='event-jid'&gt;
  92. &lt;auth-info xmlns='jabber:iq:auth'&gt;password&lt;/auth-info&gt;
  93. &lt;/subscribe&gt;
  94. &lt;/iq&gt;
  95. </example>
  96. </section3>
  97. <section3 topic='Option: &lt;reliable/&gt;'>
  98. <p>If it wishes, the subscriber may request a &quot;reliable&quot; subscription. This option guarantees that the subscriber will receive all notifications about this event (as far as the Jabber architecture guarantees delivery). This changes the semantics of the subscriber publish protocol - see section 3.6 for more details.</p>
  99. <example caption='Reliable subscription request'>
  100. &lt;iq id='sub2' type='set' from='subscriber-jid' to='ens-jid'&gt;
  101. &lt;subscribe xmlns='' jid='event-jid'&gt;
  102. &lt;reliable/&gt;
  103. &lt;/subscribe&gt;
  104. &lt;/iq&gt;
  105. </example>
  106. </section3>
  107. </section2>
  108. <section2 topic='Subscription response'>
  109. <p>Once subscribed, the ENS will return a packet of the following form to the subscriber:</p>
  110. <example caption='Successful subscription response'>
  111. &lt;iq id='sub1' type='result' from='ens-jid' to='subscriber-jid'&gt;
  112. &lt;subscribed xmlns='' jid='event-jid'/&gt;
  113. &lt;/iq&gt;
  114. </example>
  115. <p>If an error occured during subscription (such as the publisher not allowing the subscriber to subscribe), an error packet will be returned to the subscriber:</p>
  116. <example caption='Failed subscription response'>
  117. &lt;iq id='sub1' type='error' from='ens-jid' to='subscriber-jid'&gt;
  118. &lt;subscribe xmlns='' jid='event-jid'/&gt;
  119. &lt;error code='401'&gt;Unauthorized&lt;/error&gt;
  120. &lt;/iq&gt;
  121. </example>
  122. <p>The actual error fragment in the packet is a direct copy of the one returned by the publisher when it fails the authorisation request from the ENS. If the publisher does not provide one, error code 503 (Service Unavailable) will be returned instead. If the publisher does not respond to the authorisation request (after an implementation-specific timeout), error code (Remote Server Timeout) will be returned.</p>
  123. </section2>
  124. <section2 topic='Unsubscription request'>
  125. <p>To unsubscribe from a particular event, the subscriber sends a packet like of the following form to the ENS:</p>
  126. <example caption='Unsubscription request'>
  127. &lt;iq id='unsub1' type='set' from='subscriber-jid' to='ens-jid'&gt;
  128. &lt;unsubscribe xmlns='' jid='event-jid'/&gt;
  129. &lt;/iq&gt;
  130. </example>
  131. </section2>
  132. <section2 topic='Unsubscription response'>
  133. <p>Once unsubscribed, the ENS will return a packet of the following form to the subscriber:</p>
  134. <example caption='Unsubscription response'>
  135. &lt;iq id='unsub1' type='result' from='ens-jid' to='subscriber-jid'&gt;
  136. &lt;unsubscribed xmlns='' jid='event-jid'/&gt;
  137. &lt;/iq&gt;
  138. </example>
  139. <p>No further notifications for the event will be received.</p>
  140. </section2>
  141. <section2 topic='Publish'>
  142. <p>When a publisher publishes a notification to the ENS, the ENS will forward the notification to any subscribers for that event. A notification sent to a subscriber takes the following form:</p>
  143. <example caption='Event notification (publish)'>
  144. &lt;iq id='enspub1' type='set' from='ens-jid' to='subscriber-jid'&gt;
  145. &lt;publish xmlns='' jid='event-jid'/&gt;
  146. &lt;/iq&gt;
  147. </example>
  148. <p>A notification may also contain a (application-specific) &quot;payload&quot; XML fragment:</p>
  149. <example caption='Event notification (publish) with payload'>
  150. &lt;iq id='enspub2' type='set' from='ens-jid' to='subscriber-jid'&gt;
  151. &lt;publish xmlns='' jid='event-jid'&gt;
  152. &lt;xml-payload/&gt;
  153. &lt;/publish&gt;
  154. &lt;/iq&gt;
  155. </example>
  156. <p>Section 4.1 has more information about the payload.</p>
  157. <p>If the subscriber responds to the notification with an error, the subscriber will be automatically unsubscribed from the event by the ENS.</p>
  158. </section2>
  159. <section2 topic='Publish response (reliable subscriptions)'>
  160. <p>If the &lt;reliable/&gt; option was specified when the subscriber subscribed to the event, then the subscriber is expected to acknowledge a notification with a packet of the following form:</p>
  161. <example caption='Event notification (publish) response'>
  162. &lt;iq id='enspub1' type='result' from='subscriber-jid' to='ens-jid'&gt;
  163. &lt;published xmlns=''/&gt;
  164. &lt;/iq&gt;
  165. </example>
  166. <p>If the subscriber does not respond, or responds with an error, the notification will be resent by the ENS after a (implementation-specific) timeout.</p>
  167. </section2>
  168. </section1>
  169. <section1 topic='Publisher protocol'>
  170. <section2 topic='Publish'>
  171. <p>To publish a notification, the publisher sends a packet of the following form to the ENS:</p>
  172. <example caption='Event notification (publish)'>
  173. &lt;iq id='pub1' type='set' from='event-jid' to='ens-jid'&gt;
  174. &lt;publish xmlns=''/&gt;
  175. &lt;/iq&gt;
  176. </example>
  177. <p>A notification may also contain a (application-specific) &quot;payload&quot; XML fragment:</p>
  178. <example caption='Event notification (publish) with payload'>
  179. &lt;iq id='pub1' type='set' from='event-jid' to='ens-jid'&gt;
  180. &lt;publish xmlns=''&gt;
  181. &lt;xml-payload/&gt;
  182. &lt;/publish&gt;
  183. &lt;/iq&gt;
  184. </example>
  185. <p>The payload can be any well-formed XML data. Everything inside the &lt;publish/&gt; tag will be forwarded untouched to the subscriber.</p>
  186. </section2>
  187. <section2 topic='Publish response'>
  188. <p>Once the ENS has dispatched the notification to subscribers, it will return a packet of the following form to the publisher:</p>
  189. <example caption='Event notification (publish) response'>
  190. &lt;iq id='pub1' type='result' from='ens-jid' to='event-jid'&gt;
  191. &lt;published xmlns=''/&gt;
  192. &lt;/iq&gt;
  193. </example>
  194. </section2>
  195. <section2 topic='Authorisation request'>
  196. <p>A publisher is required to approve subcription requests. When a subscriber attempts to subscribe to an event, the publisher will receive a packet of the following form from the ENS:</p>
  197. <example caption='Authorisation request'>
  198. &lt;iq id='ensauth1' type='get' from='ens-jid' to='event-jid'&gt;
  199. &lt;authorise xmlns='' jid='subscriber-jid'/&gt;
  200. &lt;/iq&gt;
  201. </example>
  202. <p>The subscriber may include an &lt;auth-info/&gt; XML fragment containing some (application-specific) information that the publisher can use to authorise it:</p>
  203. <example caption='Authorisation request with authorisation information'>
  204. &lt;iq id='ensauth1' type='get' from='ens-jid' to='event-jid'&gt;
  205. &lt;authorise xmlns='' jid='subscriber-jid'&gt;
  206. &lt;auth-info xmlns='jabber:iq:auth'&gt;password&lt;/auth-info&gt;
  207. &lt;/authorise&gt;
  208. &lt;/iq&gt;
  209. </example>
  210. </section2>
  211. <section2 topic='Authorisation response'>
  212. <p>To signal to the ENS that a subscriber should be allowed to subscribe, the publisher should return a packet of the following form:</p>
  213. <example caption='Successful authorisation response'>
  214. &lt;iq id='ensauth1' type='result' from='event-jid' to='ens-jid'&gt;
  215. &lt;authorised xmlns='' jid='subscriber-jid'/&gt;
  216. &lt;/iq&gt;
  217. </example>
  218. <p>To deny the subscription, the publisher should return an error packet, containing the appropriate &lt;error/&gt; fragment:</p>
  219. <example caption='Unsuccessful authorisation response'>
  220. &lt;iq id='ensauth1' type='error' from='event-jid' to='ens-jid'&gt;
  221. &lt;authorise xmlns='' jid='subscriber-jid'/&gt;
  222. &lt;error code='401'&gt;Unauthorized&lt;/error&gt;
  223. &lt;/iq&gt;
  224. </example>
  225. <p>The &lt;error/&gt; fragment will be copied untouched into the error response sent back to the subscriber. See section 3.2 for more details.</p>
  226. </section2>
  227. </section1>
  228. <section1 topic='Errors'>
  229. <p>The ENS will respond with error code 400 (Bad Request) any time it receives a request that it cannot understand (a malformed packet, for example).</p>
  230. <p>Other errors may occur, and they are described in the appropriate sections of the above protocol specification.</p>
  231. </section1>
  232. <section1 topic='Considerations'>
  233. <p>The following items should be discussed before this proposal is approved by the Council:</p>
  234. <section2 topic='ENS discovery'>
  235. <p>The ENS, as described, works well. However, no provisions are made for a subscriber to find out which ENS a publisher is publishing to. It does a subscriber no good to subscribe to an event on the wrong ENS - the subscription would succeed (assuming the publisher allows it), but no notifications would ever be received.</p>
  236. <p>There are several potential solutions, each with their problems:</p>
  237. <ul>
  238. <li>Leave it to the subscriber to find the appropriate ENS outside of the ENS framework itself. This might be via a browse to the publisher, or maybe just entering it into their client's configuration. Obviously, this is very application-specific.</li>
  239. <li>Force the publisher to publish to multiple ENSs, as necessary. This would require additions to the protocol (to tell the publisher of new ENSs), and would require the publisher to maintain a list of JIDs it needs to publish to. This solution is pointless - if the publisher is going to publish to multiple JIDs and maintain its own list, it might as well publish direct to subscribers.</li>
  240. <li>Have some sort of ENS-to-ENS protocol, and have ENSs proxy publishes for other ENSs. This does not fix the problem, it just moves it away from the subscriber and into the ENS. An ENS will still need to find out which ENS the publisher is publishing to.</li>
  241. <li>Integrate ENS into the session manager. This leaves us with a glorified presence system, and makes the ENS basically unusable by non-session-manager-based server components.</li>
  242. </ul>
  243. <p>This problem may be outside of the scope of this specification.</p>
  244. </section2>
  245. <section2 topic='How reliable should &lt;reliable/&gt; be?'>
  246. <p>Currently, if a subscriber obtains a reliable subscription, and then disappears from the network (as an end-user client might), the ENS will continue to send notifications to it (ignoring errors) until it unsubscribes. If the subscriber never comes back, then ENS will send notifications forever (in theory).</p>
  247. <p>At what point should even &lt;reliable/&gt; have its limits? Should we unsubscribe a reliable subscriber who bounces (ie. the Jabber server failed to deliver) more than, say, 10 publishes? Or maybe they should be unsubscribed if they do not respond (as in section 3.6) to anything for, say, 10 minutes?</p>
  248. <p>&lt;reliable/&gt; is an interesting idea, but it may be that it is too problematic for its own good.</p>
  249. </section2>
  250. <section2 topic='Longevity of subscriptions'>
  251. <p>The topic of reliable subscriptions raises the question as to how long a subscription lasts. Should a subscription last forever (like &lt;presence/&gt; does), even across restarts of the server?</p>
  252. <p>If end-user clients are to be subscribers, then under this scheme the ENS would have to subscribe to presence, so as to know when the client has disconnected. Since presence is a function of the session manager, this could have the effect of making the ENS less generic that we may like.</p>
  253. </section2>
  254. <section2 topic='Replacing &lt;presence/&gt; with the ENS?'>
  255. <p>As I see it, basic presence will always be a function of the session manager, for the following reasons:</p>
  256. <ul>
  257. <li>No ENS discovery problems</li>
  258. <li>Subscriptions are maintained across sessions</li>
  259. <li>In very widespread use (ie. everywhere)</li>
  260. </ul>
  261. <p>I think the places where the ENS can boom will be in applications like avatars, and genuine event-based systems (like the kind described above - &quot;you have new mail&quot;, &quot;someone has scheduled a meeting with you in your online calendar&quot;, etc).</p>
  262. </section2>
  263. </section1>
  264. </xep>