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-0281.xml 22KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. <!ENTITY ROOM "&lt;room@service&gt;">
  6. <!ENTITY ROOMJID "&lt;room@service/nick&gt;">
  7. ]>
  8. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  9. <xep>
  10. <header>
  11. <title>DMUC1: Distributed Multi-User Chat</title>
  12. <abstract>This document defines methods for distributing Multi-User Chat (MUC) rooms across multiple chat services.</abstract>
  14. <number>0281</number>
  15. <status>Retracted</status>
  16. <type>Standards Track</type>
  17. <sig>Standards</sig>
  18. <dependencies>
  19. <spec>XEP-0045</spec>
  20. <spec>XEP-0030</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby>
  24. <spec>XEP-0289</spec>
  25. </supersededby>
  26. <shortname>NOT-YET-ASSIGNED</shortname>
  27. &stpeter;
  28. <revision>
  29. <version>0.2</version>
  30. <date>2010-07-20</date>
  31. <initials>psa</initials>
  32. <remark><p>Added protocol flows for finding and joining shadow rooms, thus removing dependency on communication with firsthost; changed examples to mimic XEP-0045.</p></remark>
  33. </revision>
  34. <revision>
  35. <version>0.1</version>
  36. <date>2010-06-11</date>
  37. <initials>psa</initials>
  38. <remark><p>Initial published version.</p></remark>
  39. </revision>
  40. <revision>
  41. <version>0.0.2</version>
  42. <date>2010-02-05</date>
  43. <initials>psa</initials>
  44. <remark><p>Simplified the protocol to use a master-slave approach; modified terminology.</p></remark>
  45. </revision>
  46. <revision>
  47. <version>0.0.1</version>
  48. <date>2007-06-01</date>
  49. <initials>psa</initials>
  50. <remark><p>First draft.</p></remark>
  51. </revision>
  52. </header>
  53. <section1 topic='Introduction' anchor='intro'>
  54. <section2 topic='Motivation' anchor='motivation'>
  55. <p>&xep0045; defines a full-featured technology for multi-user text conferencing in XMPP. By design, <cite>XEP-0045</cite> assumes that a conference room is hosted at a single service, which can be accessed from any point on the network. However, this assumption introduces a single point of failure for the conference room, since if occupants at a using domain lose connectivity to the hosting domain then they also lose connectivity to the room. In some deployment scenarios (and even on the open Internet) this behavior is suboptimal. Therefore, this document attempts to define a technology for distributing MUC rooms across multiple services.</p>
  56. </section2>
  57. <section2 topic='Requirements' anchor='requirements'>
  58. <p>This specification addresses the following requirements:</p>
  59. <ol start="1">
  60. <li>Enable distribution of a MUC room across multiple services.</li>
  61. <li>Enable a service to determine which other services it will peer with.</li>
  62. <li>Enable the room creator to specify if distribution is allowed.</li>
  63. <li>Enable occupants to remain in an instance of the conference if connectivity is lost to other instances.</li>
  64. <li>Enable syncing of history, configuration, and room rosters on reconnect.</li>
  65. </ol>
  66. </section2>
  67. <section2 topic='Approach' anchor='approach'>
  68. <p>The basic approach to distribution of MUC rooms is as follows:</p>
  69. <ol start="1">
  70. <li>A user creates a room on a service and configures it as "distributed" (or the service assumes that the room is distributed based on local service policy); this first instance of the room is called a SOURCE and the service on which it is created is called a FIRSTHOST.</li>
  71. <li>The firsthost can immediately request that other services (called PEERHOSTS) replicate the room by creating their own local instances (called SHADOWS); alternatively, the firsthost can wait to send the replication request until users from the peerhost have joined the room.</li>
  72. <li>If a user from the peerhost attempts to join the source room after replication is established, the firsthost invites the user to join the shadow rather than the source by sending a direct invitation to the user.</li>
  73. <li>As long as the peerhost and firsthost have connectivity, they share room messages, room rosters, and room configuration changes in real time. If any conflict arises, the firsthost's information rules since it is "first among equals".</li>
  74. <li>If the peerhost loses connectivity to the firsthost, it maintains the shadow, including local room history, room roster, and room configuration, and if possible also maintains connectivity with other peerhosts.</li>
  75. <li>Upon reconnecting to the firsthost, a peerhost exchanges room history and room rosters with the firsthost and receives room configuration data (if modified).</li>
  76. </ol>
  77. <p>The room IDs of source rooms SHOULD be opaque to users and unique across all possible peerhosts, for example by generating a UUID in accordance with &rfc4122; or by hashing the human-readable name of the room using the SHA-256 algorithm in accordance with &nistfips180-2;.</p>
  78. </section2>
  79. </section1>
  80. <section1 topic='Terminology' anchor='terms'>
  81. <section2 topic='General Terms' anchor='terms-general'>
  82. <p>This document adds the following terms to those defined in <cite>XEP-0045</cite>:</p>
  83. <ul>
  84. <li>Firsthost -- The MUC service at which a room is created.</li>
  85. <li>Peerhost -- Any MUC service (other than the firsthost) that hosts an instance of the room.</li>
  86. <li>Source -- The canonical instance of the room at the firsthost.</li>
  87. <li>Shadow -- An instance of the room at a peerhost.</li>
  88. </ul>
  89. </section2>
  90. <section2 topic='Entities' anchor='terms-entities'>
  91. <p>In this document, the examples use the following entities.</p>
  92. <ul>
  93. <li>Firsthost: chat.shakespeare.lit</li>
  94. <li>Peerhosts: rooms.macbeth.lit and conference.marlowe.lit</li>
  95. <li>Source: coven@chat.shakespeare.lit</li>
  96. <li>Shadows: theroom@rooms.macbeth.lit and theroom@conference.marlowe.lit</li>
  97. </ul>
  98. </section2>
  99. </section1>
  100. <section1 topic='Use Cases' anchor='usecases'>
  101. <section2 topic='Creating a Room' anchor='create'>
  102. <p>When the original room owner creates the room (or subsequently configures the room), the service MAY simply default all rooms to "distributed".</p>
  103. <p>Alternatively, the server MAY offer the option of making the room a "distributed room". This is done by including the "muc#roomconfig_distributed" feature in the room configuration form:</p>
  104. <example caption='Service Sends Configuration Form'><![CDATA[
  105. <iq from='coven@chat.shakespeare.lit'
  106. id='create1'
  107. to='crone1@shakespeare.lit/desktop'
  108. type='result'>
  109. <query xmlns=''>
  110. <x xmlns='jabber:x:data' type='form'>
  111. <field type='hidden' var='FORM_TYPE'>
  112. <value></value>
  113. </field>
  114. ...
  115. <field
  116. label='Distribute Room Across Multiple Services?'
  117. type='boolean'
  118. var='muc#roomconfig_distributed'>
  119. <value>0</value>
  120. </field>
  121. ...
  122. </x>
  123. </query>
  124. </iq>
  125. ]]></example>
  126. <p>The room owner specifies a value of "1" or "true" &BOOLEANNOTE; if room distribution is desired:</p>
  127. <example caption='Room Owner Submits Configuration Form'><![CDATA[
  128. <iq from='coven@chat.shakespeare.lit'
  129. id='configure1'
  130. to='crone1@shakespeare.lit/desktop'
  131. type='set'>
  132. <query xmlns=''>
  133. <x xmlns='jabber:x:data' type='submit'>
  134. <field type='hidden' var='FORM_TYPE'>
  135. <value></value>
  136. </field>
  137. ...
  138. <field var='muc#roomconfig_distributed'>
  139. <value>true</value>
  140. </field>
  141. ...
  142. </x>
  143. </query>
  144. </iq>
  145. ]]></example>
  146. <p>Alternatively, the firsthost can choose to perform room distribution in the background, rather than exposing the 'muc#roomconfig_distributed' option to the user.</p>
  147. </section2>
  148. <section2 topic='Replicating a Room' anchor='replication'>
  149. <p>When a firsthost would like a peerhost to provide a shadow, it sends a replication request to the peerhost.</p>
  150. <example caption='Firsthost Requests Replication of Room'><![CDATA[
  151. <iq from='chat.shakespeare.lit'
  152. id='replicate1'
  153. to='rooms.macbeth.lit'
  154. type='set'>
  155. <replicate xmlns='urn:xmpp:dmuc:0'>
  156. <room id='theroom'/>
  157. </replicate>
  158. </iq>
  159. ]]></example>
  160. <p>If the peerhost is willing and able to replicate the room, it returns an IQ-result:</p>
  161. <example caption='Peerhost Acknowledges Replication Request'><![CDATA[
  162. <iq to='rooms.macbeth.lit'
  163. id='replicate1'
  164. from='chat.shakespeare.lit'
  165. type='result'/>
  166. ]]></example>
  167. <p>Several error cases are possible (the peerhost is resource constrained, the firsthost is forbidden to peer with the peerhost, etc.); these will be specified more fully in a future version of this specification.</p>
  168. <p>Once the peerhost acknowledges that it is willing and able to replicate the room, four things happen:</p>
  169. <ol start="1">
  170. <li>The source sends the room configuration to the shadow.</li>
  171. <li>The source sends the room roster to the shadow.</li>
  172. <li>The shadow optinoally requests the room history from the source.</li>
  173. <li>The firsthost informs other peerhosts about the new peerhost.</li>
  174. </ol>
  175. <example caption='Source Sends Room Configuration to Shadow'><![CDATA[
  176. <iq from='coven@chat.shakespeare.lit'
  177. id='config1'
  178. to='theroom@rooms.macbeth.lit'
  179. type='set'>
  180. <config xmlns='urn:xmpp:dmuc:0'>
  181. <x xmlns='jabber:x:data' type='form'>
  182. <field type='hidden' var='FORM_TYPE'>
  183. <value></value>
  184. </field>
  185. ...
  186. </x>
  187. </config>
  188. </iq>
  189. ]]></example>
  190. <example caption='Shadow Acknowledges Receipt of Room Configuration'><![CDATA[
  191. <iq to='theroom@rooms.macbeth.lit'
  192. id='config1'
  193. from='coven@chat.shakespeare.lit'
  194. type='result'/>
  195. ]]></example>
  196. <example caption='Source Sends Room Roster to Shadow'><![CDATA[
  197. <iq from='coven@chat.shakespeare.lit'
  198. id='roster1'
  199. to='theroom@rooms.macbeth.lit'
  200. type='set'>
  201. <roster xmlns='urn:xmpp:dmuc:0'>
  202. <item affiliation='owner' jid='crone1@shakespeare.lit/desktop' name='foo'/>
  203. <item affiliation='admin' jid='wiccarocks@shakespeare.lit/laptop' name='bar'/>
  204. <item affiliation='none' jid='hag66@shakespeare.lit/pda' name='baz'/>
  205. </roster>
  206. </iq>
  207. ]]></example>
  208. <example caption='Shadow Acknowledges Receipt of Room Roster'><![CDATA[
  209. <iq to='theroom@rooms.macbeth.lit'
  210. id='roster1'
  211. from='coven@chat.shakespeare.lit'
  212. type='result'/>
  213. ]]></example>
  214. <p>The new shadow SHOULD request the room history. This is done by sending an IQ-get from the shadow to the source, containing a &lt;history/&gt; element qualified by the '' namespace (the syntax and semantics of this element are described in <cite>XEP-0045</cite>).</p>
  215. <example caption='Peerhost Requests Room History'><![CDATA[
  216. <iq to='theroom@rooms.macbeth.lit'
  217. id='history1'
  218. from='coven@chat.shakespeare.lit'
  219. type='get'>
  220. <room xmlns='urn:xmpp:dmuc:0'
  221. id='theroom'>
  222. <history xmlns=''/>
  223. </room>
  224. </iq>
  225. ]]></example>
  226. <p>The history request MAY include any of the attributes specified in <cite>XEP-0045:</cite>: 'maxchars', 'maxstanzas', 'seconds', and 'since'.</p>
  227. <example caption='Firsthost Sends Room History to Peerhost'><![CDATA[
  228. <iq from='coven@chat.shakespeare.lit'
  229. id='history1'
  230. to='theroom@rooms.macbeth.lit'
  231. type='result'/>
  232. <history xmlns=''>
  233. <message
  234. xmlns='jabber:client'
  235. from='coven@chat.shakespeare.lit/foo'
  236. type='groupchat'>
  237. <body>Message 1.</body>
  238. <delay xmlns='urn:xmpp:delay'
  239. from='crone1@shakespeare.lit/desktop'
  240. stamp='2002-10-13T23:58:37Z'/>
  241. </message>
  242. <message
  243. xmlns='jabber:client'
  244. from='coven@chat.shakespeare.lit/bar'
  245. type='groupchat'>
  246. <body>Message 2.</body>
  247. <delay xmlns='urn:xmpp:delay'
  248. from='wiccarocks@shakespeare.lit/laptop'
  249. stamp='2002-10-13T23:58:43Z'/>
  250. </message>
  251. <message
  252. xmlns='jabber:client'
  253. from='coven@chat.shakespeare.lit/baz'
  254. type='groupchat'>
  255. <body>Message 3.</body>
  256. <delay xmlns='urn:xmpp:delay'
  257. from='hag66@shakespeare.lit/pda'
  258. stamp='2002-10-13T23:58:49Z'/>
  259. </message>
  260. </history>
  261. </iq>
  262. ]]></example>
  263. <example caption='Peerhost Acknowledges Receipt of Room History'><![CDATA[
  264. <iq to='theroom@rooms.macbeth.lit'
  265. id='history1'
  266. from='coven@chat.shakespeare.lit'
  267. type='result'/>
  268. ]]></example>
  269. <p>The firsthost also informs other connected peerhosts about the new peerhost.</p>
  270. <example caption='Firsthost Reports New Peerhost'><![CDATA[
  271. <iq from='chat.shakespeare.lit'
  272. id='ph1'
  273. to='conference.marlowe.lit'
  274. type='set'>
  275. <peerhost xmlns='urn:xmpp:dmuc:0'>
  276. <room id='theroom'/>
  277. </peerhost>
  278. </iq>
  279. ]]></example>
  280. <example caption='Peerhost Acknowledges Notification of New Peerhost'><![CDATA[
  281. <iq from='conference.marlowe.lit'
  282. id='ph1'
  283. to='chat.shakespeare.lit'
  284. type='result'/>
  285. ]]></example>
  286. </section2>
  287. <section2 topic='Finding a Room' anchor='find'>
  288. <p>XEP-0045 specifies that rooms can be found on a chat service using &xep0030;.</p>
  289. <p>A user at a peerhost could send a service discovery items ("disco#items") request to the firsthost in order to find the source room. However, this introduces a dependency on communication with the firsthost, and we have stipulated that such communication might not be available.</p>
  290. <p>Alternatively, the peerhost could keep a list of the shadow rooms that it hosts. From the perspective of the user at the peerhost, these rooms are local in the sense that the user can join the shadow and thereby interact with the occupants of the shadow (and, if server-to-server communication is working, with the occupants of the source). This approach is RECOMMENDED.</p>
  291. <p>Note: If the peerhost frequently loses communications with the firsthost and the list of rooms located at the firsthost is large, the peerhost will want to use a more efficient method of synchronizing its room list than sending disco#items requests and receiving large disco#items results. However, methods for optimizing this synchronization process are out of scope for this specification.</p>
  292. <p>To find rooms on the peerhost, the local user sends a "disco#items" request to the peerhost.</p>
  293. <example caption='User Queries Peerhost for Rooms'><![CDATA[
  294. <iq from='somewitch@macbeth.lit/mobile'
  295. id='nb2ga51g'
  296. to='rooms.macbeth.lit'
  297. type='get'>
  298. <query xmlns=''/>
  299. </iq>
  300. ]]></example>
  301. <p>The service returns a list of the public rooms it hosts, which includes any shadow rooms.</p>
  302. <example caption='Peerhost Returns Disco Items'><![CDATA[
  303. <iq from='rooms.macbeth.lit'
  304. id='nb2ga51g'
  305. to='somewitch@macbeth.lit/mobile'
  306. type='result'>
  307. <query xmlns=''>
  308. <item jid='heath@rooms.macbeth.lit' name='A Lonely Heath'/>
  309. <item jid='coven@rooms.macbeth.lit' name='A Dark Cave'/>
  310. <item jid='forres@rooms.macbeth.lit' name='The Palace'/>
  311. <item jid='inverness@rooms.macbeth.lit' name='Macbeth&apos;s Castle'/>
  312. </query>
  313. </iq>
  314. ]]></example>
  315. <p>The user can then send a disco#info request to each room. If the room is a shadow, the service MUST include extended information about the room using the &xep0128; format, specifically with a "" FORM_TYPE and a (newly-defined) "dmuc-source" field.</p>
  316. <example caption='Room Returns Extended Disco Info Results'><![CDATA[
  317. <iq from='coven@rooms.macbeth.lit'
  318. id='hf71vs8m'
  319. to='somewitch@macbeth.lit/mobile'
  320. type='result'>
  321. <query xmlns=''>
  322. <identity category='conference' name='A Dark Cave' type='text'/>
  323. <feature var=''/>
  324. <x xmlns='jabber:x:data' type='result'>
  325. <field var='FORM_TYPE' type='hidden'>
  326. <value></value>
  327. </field>
  328. <field var='dmuc-source' label='Source Room' type='jid-single'>
  329. <value>coven@chat.shakespeare.lit</value>
  330. </field>
  331. </x>
  332. </query>
  333. </iq>
  334. ]]></example>
  335. <p>This informs the user that the source room is "coven@chat.shakespeare.lit"; as a result, the user's client can trap any outbound requests destined for the source room (service discovery, room join, etc.) and redirect them to the shadow.</p>
  336. </section2>
  337. <section2 topic='Joining a Shadow' anchor='shadowjoin'>
  338. <p>The process of joining a shadow is exactly as described in XEP-0045.</p>
  339. <example caption='Local User Seeks to Join Shadow Room'><![CDATA[
  340. <presence
  341. from='somewitch@macbeth.lit/mobile'
  342. to='coven@rooms.macbeth.lit/anotherwitch'>
  343. <x xmlns=''/>
  344. </presence>
  345. ]]></example>
  346. <p>The shadow then informs the source (and any other shadows) of the user's presence; it does so by sending presence from the roomjid of the user at the shadow to a roomjid with the same roomnick at the source and shadow(s).</p>
  347. <example caption='Shadow Informs Source of New Occupant'><![CDATA[
  348. <presence
  349. from='theroom@rooms.macbeth.lit/anotherwitch'
  350. to='coven@chat.shakespeare.lit/anotherwitch'>
  351. <x xmlns=''>
  352. <item affiliation='none' role='participant'/>
  353. </x>
  354. </presence>
  355. ]]></example>
  356. <p>The source then delivers that presence stanza to its local users. (Note: The shadow needs to send only one presence stanza to the source, thus reducing the number of stanzas sent over the server-to-server link between the peerhost and the firsthost.)</p>
  357. </section2>
  358. <section2 topic='Joining a Room' anchor='sourcejoin'>
  359. <p>If there is no local shadow available at the peerhost, or if the peerhost does not support extended service discovery information as described above, then the local user at the peerhost will end up sending a join request to the source room instead of the shadow room.</p>
  360. <p>When this happens, the firsthost determines if it will invite the user to join a shadow at a peerhost instead. The process for determining when to send invitations is implementation specific and might be subject to configuration at the firsthost (e.g., the firsthost might send invitations only to users of a domain associated with the peerhost and only after a certain number of such users have joined the room at the firsthost).</p>
  361. <p>To begin, a user at the peerhost attempts to join the source room at the firsthost:</p>
  362. <example caption='User Seeks to Join Source Room'><![CDATA[
  363. <presence
  364. from='somewitch@macbeth.lit/mobile'
  365. to='coven@chat.shakespeare.lit/firstwitch'>
  366. <x xmlns=''/>
  367. </presence>
  368. ]]></example>
  369. <p>The source room returns a &lt;redirect/&gt; presence error to the user and invites the user to join a shadow room instead.</p>
  370. <example caption='Source Informs User of a Shadow'><![CDATA[
  371. <presence
  372. from='coven@chat.shakespeare.lit/baz'
  373. to='somewitch@macbeth.lit/mobile'
  374. type='error'>
  375. <error type='cancel'>
  376. <redirect xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>rooms.macbeth.lit</redirect>
  377. </error>
  378. </presence>
  379. ]]></example>
  380. <p>Then the source invites the user to the shadow using the protocol defined in &xep0249;.</p>
  381. <example caption='Source Invites User to a Shadow'><![CDATA[
  382. <message
  383. from='coven@chat.shakespeare.lit'
  384. to='somewitch@macbeth.lit/mobile'
  385. <x xmlns='jabber:x:conference'
  386. jid='theroom@rooms.macbeth.lit'/>
  387. </message>
  388. ]]></example>
  389. <p>The user then joins the shadow.</p>
  390. <example caption='User Joins Shadow'><![CDATA[
  391. <presence
  392. from='somewitch@macbeth.lit/mobile'
  393. to='theroom@rooms.macbeth.lit/firstwitch'>
  394. <x xmlns=''/>
  395. </presence>
  396. ]]></example>
  397. <p>The shadow then informs the source (and any other shadows) of the user's presence; it does so by sending presence from the roomjid of the user at the shadow to a roomjid with the same roomnick at the source and shadow(s).</p>
  398. <example caption='Shadow Informs Source of New Occupant'><![CDATA[
  399. <presence
  400. from='theroom@rooms.macbeth.lit/firstwitch'
  401. to='coven@chat.shakespeare.lit/firstwitch'>
  402. <x xmlns=''>
  403. <item affiliation='none' role='participant'/>
  404. </x>
  405. </presence>
  406. ]]></example>
  407. <p>The source then delivers that presence stanza to its local users. (Note: The shadow needs to send only one presence stanza to the source, thus reducing the number of stanzas sent over the server-to-server link between the peerhost and the firsthost.)</p>
  408. </section2>
  409. <section2 topic='Sending a Message' anchor='send'>
  410. <p>When a user sends a message to an instance, the instance sends the message to its local occupants and to other instances.</p>
  411. <example caption='User Sends Message'><![CDATA[
  412. <message
  413. from='somewitch@macbeth.lit/mobile'
  414. to='theroom@rooms.macbeth.lit'
  415. type='groupchat'>
  416. <body>Message 4.</body>
  417. </message>
  418. ]]></example>
  419. <example caption='Instance Distributes Message'><![CDATA[
  420. <message
  421. from='theroom@rooms.macbeth.lit/firstwitch'
  422. to='theroom@conference.marlowe.lit/firstwitch'
  423. type='groupchat'>
  424. <body>Message 4.</body>
  425. </message>
  426. <message
  427. from='theroom@rooms.macbeth.lit/firstwitch'
  428. to='coven@chat.shakespeare.lit/firstwitch'
  429. type='groupchat'>
  430. <body>Message 4.</body>
  431. </message>
  432. ]]></example>
  433. <p>The source then delivers that message stanza to its local users. (Note: The shadow needs to send only one message stanza to the source, thus reducing the number of stanzas sent over the server-to-server link between the peerhost and the firsthost.)</p>
  434. </section2>
  435. <section2 topic='sync' anchor='Re-Syncing after Connectivity Loss'>
  436. <p>To follow.</p>
  437. </section2>
  438. </section1>
  439. <section1 topic='Determining Support' anchor='support'>
  440. <p>If a MUC service supports distributed rooms, it MUST return a feature of "urn:xmpp:dmuc:0" in response to service discovery information requests.</p>
  441. </section1>
  442. <section1 topic='Security Considerations' anchor='security'>
  443. <p>To follow.</p>
  444. </section1>
  445. <section1 topic='IANA Considerations' anchor='iana'>
  446. <p>This document requires no interaction with &IANA;.</p>
  447. </section1>
  448. <section1 topic='XMPP Registrar Considerations' anchor='reg'>
  449. <p>This document requires no interaction with the &REGISTRAR;.</p>
  450. </section1>
  451. <section1 topic='Acknowledgements' anchor='ack'>
  452. <p>Thanks to Jay Carlson, Boyd Fletcher, and Michael Krutsch for their early conversations regarding distributed chatrooms.</p>
  453. </section1>
  454. <section1 topic='XML Schema' anchor='schema'>
  455. <p>To follow.</p>
  456. </section1>
  457. </xep>