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-0168.xml 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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>Resource Application Priority</title>
  10. <abstract>This document defines an XMPP protocol extension to indicate the presence priority of XMPP resources for applications other than standard XMPP messaging.</abstract>
  11. &LEGALNOTICE;
  12. <number>0168</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XMPP IM</spec>
  20. <spec>XEP-0030</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>NOT_YET_ASSIGNED</shortname>
  25. &stpeter;
  26. &hildjj;
  27. <revision>
  28. <version>0.7</version>
  29. <date>2008-09-26</date>
  30. <initials>psa</initials>
  31. <remark>
  32. <ul>
  33. <li>More clearly defined the meaning of "application type".</li>
  34. <li>Modified namespaces to incorporate namespace versioning.</li>
  35. </ul>
  36. </remark>
  37. </revision>
  38. <revision>
  39. <version>0.6</version>
  40. <date>2007-11-19</date>
  41. <initials>psa</initials>
  42. <remark><p>Documented optional pubsub transport for RAP data.</p></remark>
  43. </revision>
  44. <revision>
  45. <version>0.5</version>
  46. <date>2007-11-15</date>
  47. <initials>psa</initials>
  48. <remark><p>Editorial review and consistency check.</p></remark>
  49. </revision>
  50. <revision>
  51. <version>0.4</version>
  52. <date>2007-06-06</date>
  53. <initials>psa</initials>
  54. <remark>
  55. <ul>
  56. <li>Added section on RAP-based routing of messages sent to bare JIDs.</li>
  57. <li>Removed RAP request protocol.</li>
  58. <li>Changed app attribute to ns attribute.</li>
  59. <li>Removed the application types registry since it is unnecessary if the ns attribute specifies the XML namespace of the data most closely associated with the application type.</li>
  60. <li>Updated namespaces to conform to XMPP Registrar processes.</li>
  61. </ul>
  62. </remark>
  63. </revision>
  64. <revision>
  65. <version>0.3</version>
  66. <date>2006-09-17</date>
  67. <initials>psa</initials>
  68. <remark><p>Changed im application type to messaging; added jingle-video.</p></remark>
  69. </revision>
  70. <revision>
  71. <version>0.2</version>
  72. <date>2005-12-19</date>
  73. <initials>psa</initials>
  74. <remark><p>Clarified structure of, and added schema for, RAP request namespace.</p></remark>
  75. </revision>
  76. <revision>
  77. <version>0.1</version>
  78. <date>2005-12-15</date>
  79. <initials>psa</initials>
  80. <remark><p>Initial published version.</p></remark>
  81. </revision>
  82. <revision>
  83. <version>0.0.6</version>
  84. <date>2005-11-29</date>
  85. <initials>psa</initials>
  86. <remark><p>Document cleanup.</p></remark>
  87. </revision>
  88. <revision>
  89. <version>0.0.5</version>
  90. <date>2005-11-17</date>
  91. <initials>psa</initials>
  92. <remark><p>Added support for RAP requests via IQ.</p></remark>
  93. </revision>
  94. <revision>
  95. <version>0.0.4</version>
  96. <date>2005-10-27</date>
  97. <initials>psa/jjh</initials>
  98. <remark><p>Defined registry of application types; clarified business rules; corrected schema.</p></remark>
  99. </revision>
  100. <revision>
  101. <version>0.0.3</version>
  102. <date>2005-10-24</date>
  103. <initials>psa/jjh</initials>
  104. <remark><p>Broadened previous resource flagging proposal to include priority for applications other than messaging.</p></remark>
  105. </revision>
  106. <revision>
  107. <version>0.0.2</version>
  108. <date>2005-09-26</date>
  109. <initials>psa/jjh</initials>
  110. <remark><p>Added more business rules and examples; defined service discovery guidelines.</p></remark>
  111. </revision>
  112. <revision>
  113. <version>0.0.1</version>
  114. <date>2005-09-23</date>
  115. <initials>psa/jjh</initials>
  116. <remark><p>First draft.</p></remark>
  117. </revision>
  118. </header>
  119. <section1 topic='Introduction' anchor='intro'>
  120. <p>Within the Extensible Messaging and Presence Protocol (&xmppcore;), presence indicates availability for communication. Specifically, in systems that bundle presence and instant messaging (see &xmppim;), the &lt;priority/&gt; child of the XMPP &PRESENCE; stanza indicates availability for communications qualified by the "jabber:client" namespace, especially instant messaging. However, a wide variety of entities might provide XMPP presence, including entities that are not primarily focused on IM (e.g., phones) or even entities that do not support XMPP messaging at all.</p>
  121. <p>Consider a scenario in which a contact wants to initiate a voice chat (see &xep0167;) with a user who has the following three XMPP resources:</p>
  122. <table caption='Application Presence'>
  123. <tr>
  124. <th>Resource</th>
  125. <th>Messaging Priority</th>
  126. <th>Voice Chat Priority</th>
  127. </tr>
  128. <tr>
  129. <td>desktop</td>
  130. <td>10</td>
  131. <td>5</td>
  132. </tr>
  133. <tr>
  134. <td>pda</td>
  135. <td>5</td>
  136. <td>-1</td>
  137. </tr>
  138. <tr>
  139. <td>mobile</td>
  140. <td>-1</td>
  141. <td>10</td>
  142. </tr>
  143. </table>
  144. <p>If the contact chooses the resource with which it initiates a voice chat based on the standard XMPP &lt;priority/&gt; element, the resulting behavior could be misleading (i.e., initiating the voice chat with the "desktop" resource rather than the "mobile" resource).</p>
  145. <p>What is needed is a way for the user's clients to indicate that the application priority for the three resources is different from the standard XMPP priority. This document defines such a mechanism via an optional XMPP presence extension.</p>
  146. <p>As applications of that core use case, this document also defines:</p>
  147. <ul>
  148. <li>A way for an XMPP server to mark which resource it considers to be primary for any given application type, if it has information -- such as communication preferences -- that can help it determine the primary resource.</li>
  149. <li>A way for an XMPP server to use application priority data for more intelligent routing of specially-labelled XMPP &MESSAGE; stanzas directed to a user's bare JID &LOCALBARE;.</li>
  150. </ul>
  151. </section1>
  152. <section1 topic='What Is An Application?' anchor='app'>
  153. <p>This specification deliberately leaves the meaning of the term "application" or "application type" fairly loose. Possible examples include:</p>
  154. <ul>
  155. <li>Messaging</li>
  156. <li>Voice chat</li>
  157. <li>Video chat</li>
  158. <li>Calendaring</li>
  159. <li>Whiteboarding</li>
  160. <li>Collaborative editing</li>
  161. </ul>
  162. <p>A future version of this specificaiton might establish a registry for application types.</p>
  163. </section1>
  164. <section1 topic='Application Priority' anchor='rap'>
  165. <section2 topic='Format' anchor='rap-format'>
  166. <p>Application priority is encapsulated by a &lt;rap/&gt; element qualified by the 'urn:xmpp:rap:0' namespace &VNOTE;. The attributes of the &lt;rap/&gt; element are as follows.</p>
  167. <table caption='RAP Attributes'>
  168. <tr>
  169. <th>Attribute</th>
  170. <th>Definition</th>
  171. <th>Inclusion</th>
  172. </tr>
  173. <tr>
  174. <td>ns</td>
  175. <td>The primary namespace of the application type.</td>
  176. <td>REQUIRED</td>
  177. </tr>
  178. <tr>
  179. <td>num</td>
  180. <td>The resource's priority for this application type. <note>This protocol uses a 'num' attribute rather than a 'priority' attribute to reduce confusion with standard XMPP presence.)</note></td>
  181. <td>REQUIRED</td>
  182. </tr>
  183. </table>
  184. <p>An example follows.</p>
  185. <example caption='Data format'><![CDATA[
  186. <rap xmlns='urn:xmpp:rap:0'
  187. ns='urn:xmpp:jingle:apps:rtp:0'
  188. num='5'/>
  189. ]]></example>
  190. </section2>
  191. <section2 topic='Generation' anchor='rap-gen'>
  192. <p>The following business rules apply to the generation of resource application priority by the client:</p>
  193. <ol start='1'>
  194. <li><p>A client SHOULD include a &lt;rap/&gt; element for each application type it prioritizes, but SHOULD NOT do so if the priority for that application is the same as the resource's standard XMPP priority.</p></li>
  195. <li><p>A client MUST NOT generate a &lt;rap/&gt; element that has a 'ns' attribute whose value is "jabber:client" or that has no 'ns' attribute (since the default 'ns' is "jabber:client").</p></li>
  196. <li><p>The &lt;rap/&gt; element SHOULD be empty.</p></li>
  197. </ol>
  198. <p>As explained in the following sections, there are two possible transports for RAP data: standard XMPP presence and the XMPP publish-subscribe extension.</p>
  199. </section2>
  200. <section2 topic='Presence Transport' anchor='rap-presence'>
  201. <p>RAP data MAY be included as extended content within a standard XMPP presence stanza. This is consistent with the rule that presence stanzas need to be related to the network availability or communication preferences of the entity that provides presence information.</p>
  202. <p>For the three resources ("desktop", "pda", and "mobile") mentioned above, the presence stanzas received by a contact would be as follows.</p>
  203. <example caption='Contact receives presence from user'><![CDATA[
  204. <presence from='juliet@capulet.lit/desktop' to='romeo@montague.lit/home'>
  205. <priority>10</priority>
  206. <rap xmlns='urn:xmpp:rap:0'
  207. ns='urn:xmpp:jingle:apps:rtp:0'
  208. num='5'/>
  209. </presence>
  210. <presence from='juliet@capulet.lit/pda' to='romeo@montague.lit/home'>
  211. <priority>5</priority>
  212. <rap xmlns='urn:xmpp:rap:0'
  213. ns='urn:xmpp:jingle:apps:rtp:0'
  214. num='-1'/>
  215. </presence>
  216. <presence from='juliet@capulet.lit/mobile' to='romeo@montague.lit/home'>
  217. <priority>-1</priority>
  218. <rap xmlns='urn:xmpp:rap:0'
  219. ns='urn:xmpp:jingle:apps:rtp:0'
  220. num='10'/>
  221. </presence>
  222. ]]></example>
  223. </section2>
  224. <section2 topic='Pubsub Transport' anchor='rap-pubsub'>
  225. <p>Alternatively, RAP data MAY be provided via the XMPP &xep0060; publish-subscribe extension, specifically the &xep0163; profile thereof.</p>
  226. <p>For the three resources ("desktop", "pda", and "mobile") mentioned above, the pubsub notifications received by a contact would be as follows.</p>
  227. <example caption='Contact receives pubsub notifications from user'><![CDATA[
  228. <message from='juliet@capulet.lit'
  229. id='rap1'
  230. to='romeo@montague.lit'
  231. type='headline'>
  232. <event xmlns='http://jabber.org/protocol/pubsub#event'>
  233. <items node='urn:xmpp:rap:0'>
  234. <item>
  235. <rap xmlns='urn:xmpp:rap:0'
  236. ns='urn:xmpp:jingle:apps:rtp:0'
  237. num='5'/>
  238. </item>
  239. </items>
  240. </event>
  241. <addresses xmlns='http://jabber.org/protocol/address'>
  242. <address type='replyto' jid='juliet@capulet.lit/desktop'/>
  243. </addresses>
  244. </message>
  245. <message from='juliet@capulet.lit'
  246. id='rap2'
  247. to='romeo@montague.lit'
  248. type='headline'>
  249. <event xmlns='http://jabber.org/protocol/pubsub#event'>
  250. <items node='urn:xmpp:rap:0'>
  251. <item>
  252. <rap xmlns='urn:xmpp:rap:0'
  253. ns='urn:xmpp:jingle:apps:rtp:0'
  254. num='-1'/>
  255. </item>
  256. </items>
  257. </event>
  258. <addresses xmlns='http://jabber.org/protocol/address'>
  259. <address type='replyto' jid='juliet@capulet.lit/pda'/>
  260. </addresses>
  261. </message>
  262. <message from='juliet@capulet.lit'
  263. id='rap3'
  264. to='romeo@montague.lit'
  265. type='headline'>
  266. <event xmlns='http://jabber.org/protocol/pubsub#event'>
  267. <items node='urn:xmpp:rap:0'>
  268. <item>
  269. <rap xmlns='urn:xmpp:rap:0'
  270. ns='urn:xmpp:jingle:apps:rtp:0'
  271. num='10'/>
  272. </item>
  273. </items>
  274. </event>
  275. <addresses xmlns='http://jabber.org/protocol/address'>
  276. <address type='replyto' jid='juliet@capulet.lit/mobile'/>
  277. </addresses>
  278. </message>
  279. ]]></example>
  280. </section2>
  281. </section1>
  282. <section1 topic='Flagging the Primary Resource' anchor='flag'>
  283. <p>The user's XMPP server might have special information that enables it to flag a resource as primary for a given application type. For instance, the server may include a communication policy service that enables the user to define (outside the context of any presence priorities) that she would prefer to be called at her desktop computer only between the hours of 9:00 AM and 5:00 PM local time, prefer to be called on her mobile phone at all other times, and so on.</p>
  284. <p>To flag the primary resource related to a specific application type, the server shall add a &lt;primary/&gt; child to the relevant RAP element. Here is an example:</p>
  285. <example caption='Primary resource flag'><![CDATA[
  286. <presence from='juliet@capulet.lit/mobile'>
  287. <priority>-1</priority>
  288. <rap xmlns='urn:xmpp:rap:0'
  289. ns='urn:xmpp:jingle:apps:rtp:0'
  290. num='10'>
  291. <primary/>
  292. </rap>
  293. </presence>
  294. ]]></example>
  295. <p>The following business rules apply to primary resource flagging by the server:</p>
  296. <ol start='1'>
  297. <li><p>A server MAY add the &lt;primary/&gt; element to RAP data generated by the resource it determines is "most available" for a given application type.</p></li>
  298. <li><p>Because the default 'ns' is "jabber:client", to flag the primary resource for standard XMPP communications the server SHOULD NOT include a 'ns' attribute, SHOULD NOT include a 'num' attribute, and MUST include a &lt;primary/&gt; child.</p></li>
  299. <li><p>An available resource that has specified a negative priority for an application type MUST NOT be flagged as the primary resource for that application type.</p></li>
  300. <li><p>A client SHOULD NOT include the &lt;primary/&gt; element in RAP data that it generates; however, if a client includes a &lt;primary/&gt; element, the server SHOULD remove or overwrite the element.</p></li>
  301. <li><p>In response to a presence probe, a server SHOULD send presence from the primary resource first (this enables the receiving client to skip any local "most-available-resource" algorithms it might implement) if the client includes RAP data in presence.</p></li>
  302. <li><p>If the primary resource changes for a given application type and the client includes RAP data in presence, a server MUST broadcast updated presence information (including the &lt;primary/&gt; element) for the new primary resource. If the change in primary resource occurs because of a presence broadcast from the current primary resource, the server MUST push presence from the current primary resource (without the &lt;primary/&gt; element) before pushing presence from the new primary resource (including the &lt;primary/&gt; element).</p></li>
  303. </ol>
  304. </section1>
  305. <section1 topic='RAP-Based Message Routing' anchor='route'>
  306. <p>A server MAY use the RAP data provided by a client in determining how to route incoming &MESSAGE; stanzas directed to the bare JID &LOCALBARE; of a registered account. In order to enable such routing, the sender MUST include an empty &lt;route/&gt; element qualified by the 'urn:xmpp:raproute:0' namespace &VNOTE; including an 'ns' attribute corresponding to the desired application type.</p>
  307. <p>For example, consider a &xep0155; request sent from one user (Romeo) to another (Juliet), where the users do not share presence. Romeo wants the request to be delivered to the highest-priority resource for the "urn:xmpp:jingle:apps:rtp:0" application type.</p>
  308. <example caption="User requests session"><![CDATA[
  309. <message from='romeo@montague.lit/orchard'
  310. to='juliet@capulet.lit'
  311. type='headline'>
  312. <thread>ffd7076498744578d10edabfe7f4a866</thread>
  313. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  314. <x xmlns='jabber:x:data' type='form'>
  315. <title>Open chat with Romeo?</title>
  316. <field var='FORM_TYPE' type='hidden'>
  317. <value>urn:xmpp:ssn</value>
  318. </field>
  319. <field label='Accept this session?' type='boolean' var='accept'>
  320. <value>true</value>
  321. <required/>
  322. </field>
  323. </x>
  324. </feature>
  325. <route xmlns='urn:xmpp:raproute:0'
  326. ns='urn:xmpp:jingle:apps:rtp:0'/>
  327. </message>
  328. ]]></example>
  329. <p>If Juliet's server supports RAP routing, it would then deliver the message to whichever of Juliet's resources has the highest priority for the "urn:xmpp:jingle:apps:rtp:0" application type.</p>
  330. </section1>
  331. <section1 topic='Determining Support' anchor='support'>
  332. <p>If an entity supports resource application priorities, it MUST advertise that fact by returning a feature of "urn:xmpp:rap:0", "urn:xmpp:raproute:0", or both &VNOTE; in response to &xep0030; information requests.</p>
  333. <example caption='Entity queries a server regarding protocol support'><![CDATA[
  334. <iq from='juliet@capulet.lit/balcony'
  335. id='disco1'
  336. to='capulet.lit'
  337. type='get'>
  338. <query xmlns='http://jabber.org/protocol/disco#info'/>
  339. </iq>
  340. ]]></example>
  341. <example caption='Server communicates protocol support for RAP'><![CDATA[
  342. <iq from='capulet.lit'
  343. id='disco1'
  344. to='juliet@capulet.lit/balcony'
  345. type='result'>
  346. <query xmlns='http://jabber.org/protocol/disco#info'>
  347. <feature var='urn:xmpp:rap:0'/>
  348. <feature var='urn:xmpp:raproute:0'/>
  349. </query>
  350. </iq>
  351. ]]></example>
  352. <p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
  353. </section1>
  354. <section1 topic='Security Considerations' anchor='security'>
  355. <p>When the pubsub transport is used, client publishing of resource application priority can result in a presence leak if the node access model is "open". Care should be taken in properly configuring the pubsub node so that unauthorized entities are not able to retrieve information about the user's available resources.</p>
  356. <p>Server flagging of the primary resource is not known to introduce any vulnerabilities or compromises of user privacy.</p>
  357. </section1>
  358. <section1 topic='IANA Considerations' anchor='iana'>
  359. <p>This document requires no interaction with &IANA;.</p>
  360. </section1>
  361. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  362. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  363. <p>This specification defines the following XML namespaces:</p>
  364. <ul>
  365. <li>urn:xmpp:rap:0</li>
  366. <li>urn:xmpp:raproute:0</li>
  367. </ul>
  368. <p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespaces to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
  369. </section2>
  370. <section2 topic='Namespace Versioning' anchor='registrar-versioning'>
  371. &NSVER;
  372. </section2>
  373. </section1>
  374. <section1 topic='XML Schemas' anchor='schema'>
  375. <section2 topic='RAP' anchor='schema-rap'>
  376. <code><![CDATA[
  377. <?xml version='1.0' encoding='UTF-8'?>
  378. <xs:schema
  379. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  380. targetNamespace='urn:xmpp:rap:0'
  381. xmlns='urn:xmpp:rap:0'
  382. elementFormDefault='qualified'>
  383. <xs:element name='rap'>
  384. <xs:complexType>
  385. <xs:sequence>
  386. <xs:element name='primary' type='empty' minOccurs='0' maxOccurs='1'/>
  387. </xs:sequence>
  388. <xs:attribute name='ns' type='xs:string' default='jabber:client'/>
  389. <xs:attribute name='num' type='xs:byte'/>
  390. </xs:complexType>
  391. </xs:element>
  392. <xs:simpleType name='empty'>
  393. <xs:restriction base='xs:string'>
  394. <xs:enumeration value=''/>
  395. </xs:restriction>
  396. </xs:simpleType>
  397. </xs:schema>
  398. ]]></code>
  399. </section2>
  400. <section2 topic='RAP Routing' anchor='schema-raproute'>
  401. <code><![CDATA[
  402. <?xml version='1.0' encoding='UTF-8'?>
  403. <xs:schema
  404. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  405. targetNamespace='urn:xmpp:raproute:0'
  406. xmlns='urn:xmpp:raproute:0'
  407. elementFormDefault='qualified'>
  408. <xs:element name='route'>
  409. <xs:complexType>
  410. <xs:simpleContent>
  411. <xs:extension base='empty'>
  412. <xs:attribute name='ns' type='xs:string' default='jabber:client'/>
  413. </xs:extension>
  414. </xs:simpleContent>
  415. </xs:complexType>
  416. </xs:element>
  417. <xs:simpleType name='empty'>
  418. <xs:restriction base='xs:string'>
  419. <xs:enumeration value=''/>
  420. </xs:restriction>
  421. </xs:simpleType>
  422. </xs:schema>
  423. ]]></code>
  424. </section2>
  425. </section1>
  426. </xep>