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-0163.xml 38KB

  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>Personal Eventing Protocol</title>
  10. <abstract>This specification defines semantics for using the XMPP publish-subscribe protocol to broadcast state change events associated with an instant messaging and presence account. This profile of pubsub therefore enables a standard XMPP user account to function as a virtual pubsub service, easing the discovery of syndicated data and event notifications associated with such an account.</abstract>
  12. <number>0163</number>
  13. <status>Draft</status>
  14. <type>Standards Track</type>
  15. <sig>Standards JIG</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XMPP IM</spec>
  20. <spec>XEP-0030</spec>
  21. <spec>XEP-0060</spec>
  22. <spec>XEP-0115</spec>
  23. </dependencies>
  24. <supersedes/>
  25. <supersededby/>
  26. <shortname>pep</shortname>
  27. &stpeter;
  28. &ksmith;
  29. <revision>
  30. <version>1.2.1</version>
  31. <date>2018-03-18</date>
  32. <initials>fs</initials>
  33. <remark><p>Clarify how +notify works</p></remark>
  34. </revision>
  35. <revision>
  36. <version>1.2</version>
  37. <date>2010-07-12</date>
  38. <initials>psa</initials>
  39. <remark><p>Removed the one-node-per-namespace rule (community consensus indicates that this rule was overly restrictive); clarified the meaning of auto-subscribe; clarified that sending the last published item does not prevent the service from sending additional items in some circumstances; discouraged the use of directed presence for the purpose of implicit subscriptions.</p></remark>
  40. </revision>
  41. <revision>
  42. <version>1.1</version>
  43. <date>2007-09-26</date>
  44. <initials>psa</initials>
  45. <remark><p>In accordance with XMPP Council consensus (1) explicitly defined auto-create, auto-subscribe, filtered-notifications, and last-published features, (2) moved them to XEP-0060, and (3) added appropriate references to XEP-0060 throughout; also added friendly but non-normative How It Works section and removed references to private data storage; updated to reflect changes to entity capabilities and pubsub.</p></remark>
  46. </revision>
  47. <revision>
  48. <version>1.0</version>
  49. <date>2006-09-20</date>
  50. <initials>psa</initials>
  51. <remark><p>Per a vote of the Jabber Council, advanced status to Draft.</p></remark>
  52. </revision>
  53. <revision>
  54. <version>0.15</version>
  55. <date>2006-08-30</date>
  56. <initials>psa</initials>
  57. <remark><p>Added the deliver_notifications and send_last_published_item configuration options to the recommended defaults.</p></remark>
  58. </revision>
  59. <revision>
  60. <version>0.14</version>
  61. <date>2006-08-02</date>
  62. <initials>psa</initials>
  63. <remark><p>Changed various recommended defaults from SHOULD to MUST; corrected several errors in the text and examples.</p></remark>
  64. </revision>
  65. <revision>
  66. <version>0.13</version>
  67. <date>2006-08-01</date>
  68. <initials>psa</initials>
  69. <remark><p>Recommended node creation with default configuration on initial publish; corrected several errors and clarified several points in the text.</p></remark>
  70. </revision>
  71. <revision>
  72. <version>0.12</version>
  73. <date>2006-08-01</date>
  74. <initials>psa</initials>
  75. <remark><p>Simplified the subscription process using XMPP presence and entity capabilities.</p></remark>
  76. </revision>
  77. <revision>
  78. <version>0.11</version>
  79. <date>2006-07-20</date>
  80. <initials>psa</initials>
  81. <remark><p>Clarified rules regarding number of notifications and when to generate notifications; corrected several errors in the text and examples.</p></remark>
  82. </revision>
  83. <revision>
  84. <version>0.10</version>
  85. <date>2006-07-07</date>
  86. <initials>psa</initials>
  87. <remark><p>Updated to reflect version 1.8 of XEP-0060.</p></remark>
  88. </revision>
  89. <revision>
  90. <version>0.9</version>
  91. <date>2006-06-15</date>
  92. <initials>psa</initials>
  93. <remark><p>Updated to reflect use of data forms in XEP-0060.</p></remark>
  94. </revision>
  95. <revision>
  96. <version>0.8</version>
  97. <date>2006-04-10</date>
  98. <initials>psa</initials>
  99. <remark><p>Clarified terminology and defaults.</p></remark>
  100. </revision>
  101. <revision>
  102. <version>0.7</version>
  103. <date>2006-04-10</date>
  104. <initials>psa</initials>
  105. <remark><p>Specified that notifications are to be sent from bare JID, not full JID.</p></remark>
  106. </revision>
  107. <revision>
  108. <version>0.6</version>
  109. <date>2006-04-10</date>
  110. <initials>psa</initials>
  111. <remark><p>Updated to reflect pubsub changes; clarified business rules for generation of notifications and cancellation of subscriptions.</p></remark>
  112. </revision>
  113. <revision>
  114. <version>0.5</version>
  115. <date>2006-03-09</date>
  116. <initials>psa</initials>
  117. <remark><p>Modified roster groups example to use jabber:x:data; added note about advertising client support for PEP.</p></remark>
  118. </revision>
  119. <revision>
  120. <version>0.4</version>
  121. <date>2006-02-02</date>
  122. <initials>psa/ks</initials>
  123. <remark><p>Specified rules for generation of notifications, including use of presence in determining address of intended recipient for notifications and sending of last published item on receipt of presence information; changed name to Personal Eventing Protocol; specified service discovery identity of pubsub/pep; removed section on service types; added Kevin Smith as co-author.</p></remark>
  124. </revision>
  125. <revision>
  126. <version>0.3</version>
  127. <date>2006-01-30</date>
  128. <initials>psa</initials>
  129. <remark><p>Specified that a service may enforce additional privacy and security policies; specified that an account owner must always be allowed to subscribe and to retrieve items; specified that an implementation should enforce access modifications resulting from roster state changes.</p></remark>
  130. </revision>
  131. <revision>
  132. <version>0.2</version>
  133. <date>2006-01-11</date>
  134. <initials>psa</initials>
  135. <remark><p>Updated to reflect proposed XEP-0060 modifications.</p></remark>
  136. </revision>
  137. <revision>
  138. <version>0.1</version>
  139. <date>2005-11-02</date>
  140. <initials>psa</initials>
  141. <remark><p>Initial version.</p></remark>
  142. </revision>
  143. <revision>
  144. <version>0.0.2</version>
  145. <date>2005-10-25</date>
  146. <initials>psa</initials>
  147. <remark><p>Added more details and examples.</p></remark>
  148. </revision>
  149. <revision>
  150. <version>0.0.1</version>
  151. <date>2005-10-24</date>
  152. <initials>psa</initials>
  153. <remark><p>First draft.</p></remark>
  154. </revision>
  155. </header>
  156. <section1 topic='Introduction' anchor='intro'>
  157. <section2 topic='Motivation' anchor='motivation'>
  158. <p>Personal eventing provides a way for a Jabber/XMPP user to send updates or "events" to other users, who are typically contacts in the user's roster. An event can be anything that a user wants to make known to other people, such as those described in &xep0080;, &xep0107;, &xep0108;, and &xep0118;. While the XMPP &xep0060; extension ("pubsub") can be used to broadcast such events associated, the full pubsub protocol is often thought of as complicated and therefore has not been widely implemented.
  159. <note>Instead, many "extended presence" formats are currently sent using the &PRESENCE; stanza type; unfortunately, this overloads presence, results in unnecessary presence traffic, and does not provide fine-grained control over access. The use of publish-subscribe rather than presence is therefore preferable.</note> To make publish-subscribe functionality more accessible (especially to instant messaging and presence applications that conform to &xmppim;), this document defines a simplified subset of pubsub that can be followed by instant messaging client and server developers to more easily deploy personal eventing services across the Jabber/XMPP network. We label this subset "Personal Eventing Protocol" or PEP.</p>
  160. <p class='em'>Note: Any use cases not described herein are described in <cite>XEP-0060</cite>. Also, this document does not show error flows related to the generic publish-subscribe use cases referenced herein, since they are exhaustively defined in <cite>XEP-0060</cite>. The reader is referred to <cite>XEP-0060</cite> for all relevant protocol details related to the XMPP publish-subscribe extension. This document merely defines a "subset" or "profile" of XMPP publish-subscribe.</p>
  161. </section2>
  162. <section2 topic='How It Works' anchor='howitworks'>
  163. <p>This section provides a friendly introduction to personal eventing via pubsub (PEP).</p>
  164. <p>Imagine that you are a Shakespearean character named Juliet and that you want to generate events about what music you're listening to, which anyone may see as long as they are authorized to see your online/offline presence (i.e., a pubsub access model of "presence").</p>
  165. <p>We assume that you have three contacts with the following relationship to you:</p>
  166. <ol start='1'>
  167. <li>benvolio@montague.lit, who has no subscription to your presence</li>
  168. <li>nurse@capulet.lit, who has a bidirectional subscription to your presence and who is in your "Servants" roster group</li>
  169. <li>romeo@montague.lit, who has a bidirectional subscription to your presence and who is in your "Friends" roster group</li>
  170. </ol>
  171. <p>We also assume that your server (capulet.lit) supports PEP and that your client discovered that support when you logged in.</p>
  172. <p>Now you start playing a song on your music playing software. Your client captures that "event" and publishes it to your server:</p>
  173. <example caption='Publishing an event'><![CDATA[
  174. <iq from='juliet@capulet.lit/balcony' type='set' id='pub1'>
  175. <pubsub xmlns=''>
  176. <publish node=''>
  177. <item>
  178. <tune xmlns=''>
  179. <artist>Gerald Finzi</artist>
  180. <length>255</length>
  181. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  182. <title>Introduction (Allegro vigoroso)</title>
  183. <track>1</track>
  184. </tune>
  185. </item>
  186. </publish>
  187. </pubsub>
  188. </iq>
  189. ]]></example>
  190. <p>Note the following about your publish request:</p>
  191. <ol start='1'>
  192. <li>It is sent with no 'to' address (see <link url='#approach-everyjid'>Every Account a Pubsub Service</link>).</li>
  193. <li>It specifies a node of "" (see <link url='#approach-onenode'>One Node per Namespace</link>).</li>
  194. </ol>
  195. <p>If all goes well (see <link url='#publish'>Publishing Events</link>), everyone who is interested in what you are listening to will receive notification of the event:</p>
  196. <example caption='Interested parties receive event notifications'><![CDATA[
  197. <message from='juliet@capulet.lit'
  198. to='romeo@montague.lit/orchard'
  199. type='headline'
  200. id='tunefoo1'>
  201. <event xmlns=''>
  202. <items node=''>
  203. <item>
  204. <tune xmlns=''>
  205. <artist>Gerald Finzi</artist>
  206. <length>255</length>
  207. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  208. <title>Introduction (Allegro vigoroso)</title>
  209. <track>1</track>
  210. </tune>
  211. </item>
  212. </items>
  213. </event>
  214. </message>
  215. <message from='juliet@capulet.lit'
  216. to='nurse@capulet.lit/chamber'
  217. type='headline'
  218. id='tunefoo2'>
  219. <event xmlns=''>
  220. <items node=''>
  221. <item>
  222. <tune xmlns=''>
  223. <artist>Gerald Finzi</artist>
  224. <length>255</length>
  225. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  226. <title>Introduction (Allegro vigoroso)</title>
  227. <track>1</track>
  228. </tune>
  229. </item>
  230. </items>
  231. </event>
  232. </message>
  233. ]]></example>
  234. <p>Because PEP services must send notifications to the account owner, you too receive the notification at each of your resources (here "balcony" and "chamber").</p>
  235. <example caption='Publisher receives event notification'><![CDATA[
  236. <message from='juliet@capulet.lit'
  237. to='juliet@capulet.lit/balcony'
  238. type='headline'
  239. id='tunefoo3'>
  240. <event xmlns=''>
  241. <items node=''>
  242. <item>
  243. <tune xmlns=''>
  244. <artist>Gerald Finzi</artist>
  245. <length>255</length>
  246. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  247. <title>Introduction (Allegro vigoroso)</title>
  248. <track>1</track>
  249. </tune>
  250. </item>
  251. </items>
  252. </event>
  253. </message>
  254. <message from='juliet@capulet.lit'
  255. to='juliet@capulet.lit/chamber'
  256. type='headline'
  257. id='tunefoo4'>
  258. <event xmlns=''>
  259. <items node=''>
  260. <item>
  261. <tune xmlns=''>
  262. <artist>Gerald Finzi</artist>
  263. <length>255</length>
  264. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  265. <title>Introduction (Allegro vigoroso)</title>
  266. <track>1</track>
  267. </tune>
  268. </item>
  269. </items>
  270. </event>
  271. </message>
  272. ]]></example>
  273. <p>But how do Romeo and the Nurse tell your server that they are interested in knowing what you're listening to? In generic pubsub they typically need to explicitly subscribe to your "" node. <note>That may still be necessary for open access model nodes in PEP if another user does not send you presence, such as benvolio@montague.lit in our scenario.</note> But PEP services support two special features:</p>
  274. <ol>
  275. <li>"auto-subscribe" -- because they are subscribed to your presence, they automatically receive your events (see <link url='#approach-presence'>Use Presence</link>).</li>
  276. <li>"filtered-notification" -- they can include some special flags in their &xep0115; information to specify which event types (payloads) they want to receive (see <link url='#approach-filter'>Filtered Notifications</link>).</li>
  277. </ol>
  278. <example caption='Romeo sends presence with caps'><![CDATA[
  279. <presence from='romeo@montague.lit/orchard'>
  280. <c xmlns=''
  281. hash='sha-1'
  282. node=''
  283. ver='zHyEOgxTrkpSdGcQKH8EFPLsriY='/>
  284. </presence>
  285. ]]></example>
  286. <p>Your server knows to send tune information to Romeo because when the server unpacks the value of the 'ver' attribute ("054H4A7280JuT6+IroVYxgCAjZo=") in accordance with <cite>XEP-0115</cite>, it discovers that Romeo's client advertises a service discovery feature of "", where the "+notify" suffix indicates interest in receiving notifications of the node whose NodeID precedes the suffix (see <cite>XEP-0060 § 9.2</cite>). The server can verify this support if needed by sending a service discovery request to Romeo's full JID, where the response would be as follows:</p>
  287. <example caption='Disco#info result from extension'><![CDATA[
  288. <iq from='romeo@montague.lit/orchard'
  289. to='juliet@capulet.lit'
  290. type='result'
  291. id='disco123'>
  292. <query xmlns=''>
  293. <identity category='client' name='Exodus 0.9.1' type='pc'/>
  294. <feature var=''/>
  295. <feature var=''/>
  296. <feature var=''/>
  297. <feature var=''/>
  298. <feature var=''/>
  299. <feature var=''/>
  300. </query>
  301. </iq>
  302. ]]></example>
  303. <p>Naturally your server doesn't need to send out a disco#info request every time, since it will quickly create a large cache of 'ver' values.</p>
  304. <p>So that's the general idea.</p>
  305. </section2>
  306. </section1>
  307. <section1 topic='Concepts and Approach' anchor='approach'>
  308. <p>Personal eventing via pubsub ("PEP") is based on the following principles:</p>
  309. <ol start='1'>
  310. <li>Every account a pubsub service.</li>
  311. <li>One publisher per node.</li>
  312. <li>Use presence.</li>
  313. <li>Filter notifications based on expressed interest.</li>
  314. <li>Smart defaults.</li>
  315. </ol>
  316. <p>These principles are described more fully below.</p>
  317. <section2 topic='Every Account a Pubsub Service' anchor='approach-everyjid'>
  318. <p>When a user creates an account (or has an account provisioned) at a Jabber/XMPP server that supports PEP, the server associates a virtual pubsub service with the account. This greatly simplifies the task of discovering the account owner's personal pubsub nodes, since the root pubsub node simply is the account owner's bare JID &BAREJID;. This assumption also simplifies publishing and subscribing.</p>
  319. </section2>
  320. <section2 topic='One Publisher Per Node' anchor='approach-publisher'>
  321. <p>There is no need for multiple publishers to a PEP service, since by definition the service generates information associated with only one entity. The owner-publisher for every node is the bare JID of the account owner.</p>
  322. </section2>
  323. <section2 topic='Use Presence' anchor='approach-presence'>
  324. <p>Although generic publish-subscribe services do not necessarily have access to presence information about subscribers, PEP services are integrated with presence in the following ways:</p>
  325. <ul>
  326. <li>Each messaging and presence account simply <em>is</em> a virtual publish-subscribe service.</li>
  327. <li>The default access model is "presence".</li>
  328. <li>A contact's subscription to an account owner's personal eventing data is automatically created because the contact has an XMPP presence subscription (the "auto-subscribe" feature).</li>
  329. <li>Services take account of subscriber presence in the generation of notifications. <note>This works only if the subscription state is "both" (see <cite>RFC 3921</cite>).</note></li>
  330. <li>A service automatically sends notifications to all of the account owner's connected resources (subject to notification filtering).</li>
  331. </ul>
  332. <p>These uses of presence simplify the task of developing compliant clients (cf. &xep0134;).</p>
  333. <p class='box'>Note: It is strongly NOT RECOMMENDED to use directed presence with Entity Capabilities data that differs from the data included in broadcast presence for the purpose of establishing implicit PEP subscriptions to another entity, because the directed presence information will be overwritten by any subsequent presence broadcast.</p>
  334. </section2>
  335. <section2 topic='Filtered Notifications' anchor='approach-filter'>
  336. <p>By default, the existence of an XMPP presence subscription is used to establish a PEP subscription to the account owner's personal eventing data. In order to filter which notifications are sent by the PEP service, the contact's client includes extended &xep0115; information in the presence notifications it sends to the account owner. Because the PEP service supports the "filtered-notifications" feature, it sends only those notifications that match the contact's expressed notification preferences.</p>
  337. </section2>
  338. <section2 topic='Smart Defaults' anchor='approach-defaults'>
  339. <p>Most pubsub configuration options and metadata are not needed for personal eventing. Instead, PEP services offer smart defaults to simplify node creation and management.</p>
  340. </section2>
  341. </section1>
  342. <section1 topic='Publishing Events' anchor='publish'>
  343. <p>An account owner publishes an item to a node by following the protocol specified in <cite>XEP-0060</cite>:</p>
  344. <example caption='Account owner publishes item'><![CDATA[
  345. <iq from='juliet@capulet.lit/balcony' type='set' id='pub1'>
  346. <pubsub xmlns=''>
  347. <publish node=''>
  348. <item>
  349. <tune xmlns=''>
  350. <artist>Gerald Finzi</artist>
  351. <length>255</length>
  352. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  353. <title>Introduction (Allegro vigoroso)</title>
  354. <track>1</track>
  355. </tune>
  356. </item>
  357. </publish>
  358. </pubsub>
  359. </iq>
  360. ]]></example>
  361. <p>If the node does not already exist, the PEP service MUST create the node. This "auto-create" feature (defined in <cite>XEP-0060</cite>) MUST be supported by a PEP service. (Naturally, the account owner's client MAY follow the node creation use case specified in <cite>XEP-0060</cite> before attempting to publish an item.)</p>
  362. <p>A PEP service SHOULD also support the "publish-options" feature defined in <cite>XEP-0060</cite>.</p>
  363. <p>If the publication logic dictates that event notifications shall be sent, the account owner's server generates notifications and sends them to all appropriate entities as described in the <link url='#notify'>Receiving Event Notifications</link> section of this document, as well as to any of the account owner's available resources.</p>
  364. <p class='box'>Note: PEP ties the receipt of PEP notifications to the subscriber's presence, but does not tie the generation of PEP notifications to the publisher's presence. If the publisher wishes to stop generating PEP events (or to generate an "empty" event as can be done for some PEP payloads) before ending its presence session, the publisher MUST direct its client to do so and MUST NOT depend on the PEP service to automatically "zero out" its PEP information when the PEP service receives unavailable presence from the publisher.</p>
  365. </section1>
  366. <section1 topic='Receiving Event Notifications' anchor='notify'>
  367. <p>An entity shall receive event notifications if:</p>
  368. <ol start='1'>
  369. <li>The node has an open access model and the entity has explicitly or implicitly subscribed to the node as explained in <cite>XEP-0060</cite>.</li>
  370. <li>The entity shares presence with the account owner (see <link url='#notify-presence'>Presence Sharing</link>), is authorized to receive events from the node in accordance with the node access model (see <cite>XEP-0060</cite>), and advertises an interest in the payload type (see <link url='#notify-filter'>Notification Filtering</link>).</li>
  371. <li>The entity is the account owner itself, in which case the PEP service shall send notifications to all of the account owner's available resources (subject to <link url='#notify-filter'>notification filtering</link>).</li>
  372. </ol>
  373. <section2 topic='Automatic Subscriptions' anchor='notify-autosubscribe'>
  374. <p>A PEP service MUST support the "auto-subscribe" feature defined in Section 9.1 of <cite>XEP-0060</cite>. This implies that when a user has an XMPP presence subscription to the account owner's presence, the user automatically also has the right to subscribe to any of the account owner's PEP nodes (if the access model is the default of "presence") and to retrieve items from such PEP nodes.</p>
  375. </section2>
  376. <section2 topic='Notification Filtering' anchor='notify-filterednotifications'>
  377. <p>A PEP service MUST support the "filtered-notifications" feature defined in Section 9.2 of <cite>XEP-0060</cite>. This implies that when an automatic subscriber can specify which event payloads it wants to receive by including appropriate feature bundles in the <cite>XEP-0115</cite> information it broadcasts.</p>
  378. </section2>
  379. <section2 topic='Generating Notifications' anchor='notify-generate'>
  380. <section3 topic='Addressing' anchor='notify-addressing'>
  381. <ol start='1'>
  382. <li><p>The server MUST set the 'from' address on the notification to the bare JID &BAREJID; of the account owner (in these examples, "juliet@capulet.lit").</p></li>
  383. <li><p>Any errors generated by the recipient or the recipient's server in relation to the notification MUST be directed to the JID of the 'from' address on the notification (i.e., the bare JID) so that bounce processing can be handled by the PEP service rather than by the publishing client.</p></li>
  384. <li><p>When sending notifications to an entity that has a presence subscription to the account owner, the server SHOULD include an &xep0033; "replyto" extension specifying the publishing resource (in this example, "juliet@capulet.lit/balcony"); this enables the subscriber's client to differentiate between information received from each of the account owner's resources (for example, different resources may be in different places and therefore may need to specify distinct geolocation data). However, a server MUST NOT include the "replyto" address when sending a notification to an entity that does not have a presence subscription to the account owner.</p></li>
  385. <li><p>If the PEP service has presence information about the intended recipient, it SHOULD direct the notification(s) to the full JID(s) of the recipient's &FULLJID;; if the PEP service does not have presence information about a subscriber, it MUST address the notification to the subscriber's bare JID &BAREJID;.</p></li>
  386. </ol>
  387. </section3>
  388. <section3 topic='Number of Notifications' anchor='notify-num'>
  389. <ol start='1'>
  390. <li><p>If an entity subscribed using a full JID &FULLJID; or a bare domain identifier &DOMAINBARE;, a PEP service MUST send one notification only, addressed to the subscribed JID.</p></li>
  391. <li><p>If a subscriber subscribed using a bare JID &LOCALBARE; and a PEP service does not have appropriate presence information about the subscriber, a PEP service MUST send at most one notification, addressed to the bare JID &LOCALBARE; of the subscriber, and MAY choose not to send any notification. (By "appropriate presence information" is meant an available presence stanza with <cite>XEP-0115</cite> data that indicates interest in the relevant data format.)</p></li>
  392. <li><p>If a subscriber subscribed using a bare JID &LOCALBARE; and a PEP service has appropriate presence information about the subscriber, the PEP service MUST send one notification to the full JID &FULLJID; of each of the subscriber's available resources that have included <cite>XEP-0115</cite> information indicating an interest in the data format.</p></li>
  393. </ol>
  394. </section3>
  395. <section3 topic='When to Generate Notifications' anchor='notify-when'>
  396. <ol start='1'>
  397. <li><p>When an account owner publishes an item to a node, a PEP service MUST generate a notification and send it to all appropriate subscribers (where the number of notifications is determined by the foregoing rules).</p></li>
  398. <li><p>When a PEP service receives initial presence <note>By "initial presence" is meant a presence stanza with no 'type' attribute that the PEP service receives after the subscriber was previously unavailable; any subsequent presence stanza with no 'type' attribute that the PEP service receives after the initial presence notification but before the subscriber against goes offline MUST NOT trigger sending of a new pubsub notification.</note> from a subscriber's resource including <cite>XEP-0115</cite> information that indicates an interest in the data format, it MUST generate a notification containing at least the last published item for that node and send it to the newly-available resource; see below under <link url='#notify-last'>Sending the Last Published Item</link>.</p></li>
  399. <li><p>As an exception to the foregoing MUST rules, a PEP service MUST NOT send notifications to a subscriber if the user has blocked the subscriber from receiving the kind of stanza used for notifications (typically message stanzas) by means of communications blocking as specified in &xep0016; or &xep0191;.</p></li>
  400. </ol>
  401. </section3>
  402. <section3 topic='Sending the Last Published Item' anchor='notify-last'>
  403. <p>As mentioned, a PEP service MUST send the last published item to all new subscribers and to all newly-available resources for each subscriber, including the account owner itself. (That is, the default value of the "pubsub#send_last_published_item" node configuration field must be "on_sub_and_presence"; this behavior essentially mimics the functionality of presence as defined in <cite>XMPP IM</cite>.) When processing a new subscription, the service MAY send not only the last published item but instead all items that are currently associated with the node (i.e., up to the maximum number of items at the node, which might be one if the node is a "singleton node" as described in <cite>XEP-0060</cite>). If the service has knowledge about the datetime that a subscriber's newly-available resource last received updated information from the node (e.g., as described in &xep0256;) then it MAY also send more items that only the last published item to the newly-available resource.</p>
  404. <p class='box'>Note: The "on_sub_and_presence" setting relates to the <em>subscriber's</em> presence, not the publisher's presence.</p>
  405. <example caption='Subscriber sends presence from newly-available resource'><![CDATA[
  406. <presence from='romeo@montague.lit/orchard'>
  407. <c xmlns=''
  408. hash='sha-1'
  409. node=''
  410. ver='zHyEOgxTrkpSdGcQKH8EFPLsriY='/>
  411. </presence>
  412. ]]></example>
  413. <example caption='Subscriber&apos;s server sends presence from newly-available resource to publisher&apos;s bare JID (i.e., PEP service)'><![CDATA[
  414. <presence from='romeo@montague.lit/orchard' to='juliet@capulet.lit'>
  415. <c xmlns=''
  416. hash='sha-1'
  417. node=''
  418. ver='zHyEOgxTrkpSdGcQKH8EFPLsriY='/>
  419. </presence>
  420. ]]></example>
  421. <example caption='PEP service sends last published item to newly-available resource'><![CDATA[
  422. <message from='juliet@capulet.lit'
  423. to='romeo@montague.lit/orchard'
  424. type='headline'
  425. id='foo'>
  426. <event xmlns=''>
  427. <items node=''>
  428. <item>
  429. <tune xmlns=''>
  430. <artist>Gerald Finzi</artist>
  431. <length>255</length>
  432. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  433. <title>Introduction (Allegro vigoroso)</title>
  434. <track>1</track>
  435. </tune>
  436. </item>
  437. </items>
  438. </event>
  439. <delay xmlns='urn:xmpp:delay' stamp='2003-12-13T23:58:37Z'/>
  440. </message>
  441. ]]></example>
  442. </section3>
  443. </section2>
  444. </section1>
  445. <section1 topic='Recommended Defaults' anchor='defaults'>
  446. <p>A PEP service MUST:</p>
  447. <ul>
  448. <li>Support the node discovery, node creation, node deletion, publish item, subscribe, unsubscribe, and item retrieval use cases specified in <cite>XEP-0060</cite>.</li>
  449. <li>Support the "auto-create", "auto-subscribe", and "filtered-notifications" features.</li>
  450. <li>Support the "owner" and "subscriber" affiliations.</li>
  451. <li>Support the "presence" access model and set it to the default.</li>
  452. <li>Support the "open", "roster", and "whitelist" access models.</li>
  453. <li>Treat the account owner's bare JID &BAREJID; as a collection node (i.e., as the root collection node for the account's virtual pubsub service).</li>
  454. <li>Default the 'deliver_notifications' configuration option to true (i.e., deliver payloads by default).</li>
  455. <li>Default the 'send_last_published_item' configuration option to on_sub_and_presence (i.e., send the last published item on subscription and on receipt of presence). <note>Because subscriptions are implicit in PEP rather than explicit as in generic pubsub, the on_sub_and_presence setting effectively means sending on presence.</note></li>
  456. </ul>
  457. <p>A PEP service MAY support other use cases, affiliations, access models, and features, but such support is OPTIONAL.</p>
  458. </section1>
  459. <section1 topic='Determining Support' anchor='support'>
  460. <section2 topic='Account Owner Service Discovery' anchor='support-owner'>
  461. <p>Naturally, before an account owner attempts to complete any PEP use cases, its client SHOULD determine whether the account owner's server supports PEP; to do so, it MUST send a &xep0030; information request to its own bare JID:</p>
  462. <example caption='Account owner queries server regarding protocol support'><![CDATA[
  463. <iq from='juliet@capulet.lit/balcony'
  464. to='juliet@capulet.lit'
  465. id='disco1'
  466. type='get'>
  467. <query xmlns=''/>
  468. </iq>
  469. ]]></example>
  470. <p>If the account owner's server supports PEP and the account is provisioned for PEP, the server MUST return an identity of "pubsub/pep" on behalf of the account (as well as a list of the namespaces and other features it supports, including all supported <cite>XEP-0060</cite> features):</p>
  471. <example caption='Server communicates protocol support'><![CDATA[
  472. <iq from='juliet@capulet.lit'
  473. to='juliet@capulet.lit/balcony'
  474. id='disco1'
  475. type='result'>
  476. <query xmlns=''>
  477. <identity category='account' type='registered'/>
  478. <identity category='pubsub' type='pep'/>
  479. <feature var=''/>
  480. <feature var=''/>
  481. <feature var=''/>
  482. <feature var=''/>
  483. <feature var=''/>
  484. <feature var=''/>
  485. <feature var=''/>
  486. <feature var=''/>
  487. <feature var=''/>
  488. <feature var=''/>
  489. <feature var=''/>
  490. ...
  491. </query>
  492. </iq>
  493. ]]></example>
  494. </section2>
  495. <section2 topic='Contact Service Discovery' anchor='support-contact'>
  496. <p>A contact MAY send service discovery requests to the account owner's bare JID &BAREJID;. If the contact already has a subscription to the account owner's presence, this is not necessary in order to receive notifications from the account owner via personal eventing. However, a user without a presence subscription needs to do so in order to discover if the account owner is a virtual pubsub service and to discover the account owner's eventing nodes. The relevant protocol flows are demonstrated in <cite>XEP-0060</cite>.</p>
  497. <p>Note: When returning disco#items results, the account owner's server MUST check the access model for each of the account owner's PEP nodes and MUST return as service discovery items only those nodes to which the contact is allowed to subscribe or from which the contact is allowed to retrieve items without first subscribing.</p>
  498. </section2>
  499. </section1>
  500. <section1 topic='Implementation Notes' anchor='impl'>
  501. <section2 topic='Cancelling Subscriptions' anchor='impl-subscriptions'>
  502. <p>In order to ensure appropriate access to information published at nodes of type "presence" and "roster", a PEP service MUST re-calculate access controls when:</p>
  503. <ol start='1'>
  504. <li>A presence subscription state changes (e.g., when a subscription request is approved).</li>
  505. <li>A roster item is modified (e.g., when the item is moved to a new roster group).</li>
  506. </ol>
  507. <p>If the modification results in a loss of access, the service MUST cancel the entity's subscription. In addition, the service MAY send a message to the (former) subscriber informing it of the cancellation (for information about the format of messages sent to notify subscribers of subscription cancellation, see the "Notification of Subscription Denial or Cancellation" section of <cite>XEP-0060</cite>).</p>
  508. </section2>
  509. <section2 topic='One Node Per Namespace' anchor='approach-onenode'>
  510. <p>An earlier version of this document specified that there could be only one publish-subscribe node associated with any given payload type (XML namespace) for the account owner (e.g., there could be only one pubsub node for geolocation events, one node for tune events, and one node for mood events, etc.). However, this rule is now considered overly restrictive because some data formats can be used to encapsulate many different kinds of information; the usual example is Atom as defined in &rfc4287;, for which many extensions exist. Therefore, this document now does not specify that there is a one-to-one relationship between NodeIDs and payload namespaces.</p>
  511. <p>A specification that defines a given payload format for use in PEP MUST specify whether there shall be only one node per namespace, or whether multiple NodeIDs for the same namespace are allowable.</p>
  512. </section2>
  513. </section1>
  514. <section1 topic='Security Considerations' anchor='security'>
  515. <p>A PEP service MAY enforce additional privacy and security policies when determining whether an entity is allowed to subscribe to a node or retrieve items from a node; however, any such policies shall be considered specific to an implementation or deployment and are out of scope for this document.</p>
  516. </section1>
  517. <section1 topic='IANA Considerations' anchor='iana'>
  518. <p>This document requires no interaction with &IANA;.</p>
  519. </section1>
  520. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  521. <section2 topic='Service Discovery Category/Type' anchor='registrar-disco'>
  522. <p>The &REGISTRAR; includes a category of "pubsub" in its registry of Service Discovery identities (see &DISCOCATEGORIES;); as a result of this document, the Registrar includes a type of "pep" to that category.</p>
  523. <p>The registry submission is as follows:</p>
  524. <code><![CDATA[
  525. <category>
  526. <name>pubsub</name>
  527. <type>
  528. <name>pep</name>
  529. <desc>
  530. A personal eventing service that supports the
  531. publish-subscribe subset defined in XEP-0163.
  532. </desc>
  533. <doc>XEP-0163</doc>
  534. </type>
  535. </category>
  536. ]]></code>
  537. </section2>
  538. </section1>
  539. <section1 topic='XML Schema' anchor='schema'>
  540. <p>Because PEP simply reuses the protocol specified in <cite>XEP-0060</cite>, a separate schema is not needed.</p>
  541. </section1>
  542. <section1 topic='Acknowledgements' anchor='ack'>
  543. <p>The authors wish to thank the participants in the XMPP Interoperability Testing Event held July 24 and 25, 2006, who provided valuable feedback that resulted in radical simplification of the protocol.</p>
  544. <p>Thanks also to the many members of the discussion list who patiently suffered through seemingly endless discussion of the auto-create and publish-and-configure features.</p>
  545. </section1>
  546. </xep>