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-0311.xml 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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>MUC Fast Reconnect</title>
  10. <abstract>This document provides a protocol that can be used for limiting the amount of presence history needed when rejoining a MUC room.</abstract>
  11. &LEGALNOTICE;
  12. <number>0311</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-0045</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>MFR</shortname>
  25. &ksmithisode;
  26. <revision>
  27. <version>0.1</version>
  28. <date>2012-01-25</date>
  29. <initials>psa</initials>
  30. <remark><p>Version approved for publication by the XMPP Council.</p></remark>
  31. </revision>
  32. <revision>
  33. <version>0.0.1</version>
  34. <date>2012-01-05</date>
  35. <initials>kis</initials>
  36. <remark><p>First draft.</p></remark>
  37. </revision>
  38. </header>
  39. <section1 topic='Introduction' anchor='intro'>
  40. <p>A client joining a &xep0045; room will receive a significant volume of data, in the form of presence from the current room occupants and past ("context" or "history") messages. If the client has recently been in the room (for example if it has needed to reconnect only because of a networking error) it may already know most of the current state, and receipt of these data will be redundant. XEP-0045 provides a method for limiting the context messages received when joining but no method for limiting the duplication of known presence; this document expands slightly upon the former and provides the latter.</p>
  41. </section1>
  42. <section1 topic='Requirements' anchor='reqs'>
  43. <p>Reduce the volume of redundant data sent to a client.</p>
  44. </section1>
  45. <section1 topic='Discovery' anchor='discovery'>
  46. <p>MUC Rooms supporting this should have a disco feature of "urn:xmpp:presence-session:0".</p>
  47. <p>To avoid extra roundtrips for discovery, clients may speculatively send elements when initially joining a MUC, and treat the absense of appropriate elements in the responses to indicate a lack of support.</p>
  48. </section1>
  49. <section1 topic='Use Cases' anchor='usecases'>
  50. <section2 topic='Initial Join' anchor='initial'>
  51. <p>In this example, Romeo (romeo@montague.lit) is joining the MUC room orchard@chats.capulet.lit. To use MUC Fast Reconnect for future joins, the initial MUC join presence stanza MUST also contain a presence-session element in the namespace "urn:xmpp:presence-session:0" with no attributes.</p>
  52. <example caption="Romeo sends 'room join' presence" ><![CDATA[
  53. <presence
  54. from='romeo@montague.lit/lane'
  55. to='orchard@chat.capulet.lit/Romeo'>
  56. <x xmlns='http://jabber.org/protocol/muc'/>
  57. <presence-session xmlns="urn:xmpp:presence-session:0"/>
  58. </presence>
  59. ]]></example>
  60. <p>If a client has indicated that it's using MUC Fast Reconnect on its session, the MUC service MUST annotate the presence stanzas it sends with elements containing a presence-session element with namespace "urn:xmpp:presence-session:0", a "session" attribute and an "id" attribute, described below.</p>
  61. <example caption="Romeo receives an occupant's presence" ><![CDATA[
  62. <presence
  63. from='orchard@chat.capulet.lit/Juliet'
  64. to='romeo@montague.lit/lane'>
  65. <x xmlns='http://jabber.org/protocol/muc#user'>
  66. <item affiliation='owner' role='moderator'/>
  67. </x>
  68. <presence-session xmlns="urn:xmpp:presence-session:0" session="u8e8t2thu" id="893oehh"/>
  69. </presence>
  70. ]]></example>
  71. <p>Attributes:</p>
  72. <ul>
  73. <li>session: This is an opaque, string, identifier provider by the MUC room and may be used by the server to distinguish between stanzas that will potentially have the same id, but be for logically different rooms (e.g. because the room was deleted and another created with the same name in the time between the client leaving and trying to fast rejoin).</li>
  74. <li>id: This (also opaque, string) is a per-stanza identifier that, when paired with the session, gives a unique identifier for every presence update.</li>
  75. <li>type: This is empty for the normal case, and has a value of "resume" when a client requests a session resumption, or "truncated" when a room is announcing that it is not transmitting the full history to a joining client (see below)</li>
  76. </ul>
  77. </section2>
  78. <section2 topic="Fast rejoin" anchor = "rejoin">
  79. <p>If Romeo then leaves the room and wants to rejoin, his client can attempt a fast rejoin. To request only the presence changes since he was last an occupant, it includes a presence-session element in his room join stanza, again with namespace "urn:xmpp:presence-session:0", with a type attribute whose value is "resume" and the session and id attributes of the last presence it received from the room prior to leaving. This corresponds to the "last known state".</p>
  80. <example caption="Romeo performs a fast rejoin on the room" ><![CDATA[
  81. <presence
  82. from='romeo@montague.lit/lane'
  83. to='orchard@chat.capulet.lit/Romeo'>
  84. <x xmlns='http://jabber.org/protocol/muc'/>
  85. <presence-session xmlns="urn:xmpp:presence-session:0" session="u8e8t2thu" id="893oehh" type="resume"/>
  86. </presence>
  87. ]]></example>
  88. <p>When the MUC room receives a room fast rejoin request, it MUST either satisfy the request by sending incremental updates to the room state <em>or</em> send a complete set of stanzas to reestablish the current state.</p>
  89. <p>If the room is able to update the client's state incrementally, it SHOULD only send those presence stanzas needed by the client to remove any occupants no longer in the room, add any newly joined occupants and update the state of any occupants whose status has changed (either because they have changed their presence sent to the room (e.g. changed to an 'away' state) or because their status within the MUC has changed (e.g. they have become a moderator). If the incremental stanzas would present a greater volume of data than a fresh join, it is RECOMMENDED that the server sends fresh join information instead.</p>
  90. <p> If the server is unable to calculate the stanzas required to send the client an incremental update (or if it is to send a fresh join for some other reason), it MUST first send an 'unavailable' presence from the room's bare JID, followed by a normal full join, as above</p>
  91. <p>All the presence stanzas (apart from the initial unavailable presence used to reset state before a clean join) MUST contain the presence-session element as described above.</p>
  92. <example caption="Romeo receives an 'unavailable' presence from the room, indicating that it is a clean join." ><![CDATA[
  93. <presence
  94. to='romeo@montague.lit/lane'
  95. from='orchard@chat.capulet.lit'
  96. type='unavailable'/>
  97. ]]></example>
  98. <p>The room SHOULD only send the unavailable presence, forcing a sending of all the occupants' presence, if it would either result in fewer transmitted stanzas than sending the necessary delta, or it is unable to provide the necessary delta (such as if too much time has past and it no longer has records of the old state).</p>
  99. </section2>
  100. <section2 topic='Receiving only unseen messages' anchor='unseenmessages'>
  101. <p>XEP-0045 provides several ways to limit the history/context messages received on join, but none of these allow a client to accurately request only the messages they have yet to see. To address this, the MUC service annotates each message with an id (in the same manner as presence, above), and the room will consider only messages since the last stanza the client received when applying the default/maxchars/maxstanzas/seconds/since rules from -45 for sending context. If the room doesn't send the full history of messages that the client has yet to receive (e.g. due to the application of history controls or because the server hasn't stored them) it sends a message to the client such the client knows it only has partial history.</p>
  102. <p>Some informal examples:</p>
  103. <ul>
  104. <li>There have been 9 messages since the client was last in the room, and the client joins requesting a maximum of 20 stanzas. The client receives the 9 messages.</li>
  105. <li>There have been 9 messages since the client was last in the room, and the client joins requesting a maximum of 5 stanzas. The client first receives a message that the history has been truncated and then the 5 most recent messages.</li>
  106. <li>There have been 9 messages since the client was last in the room, and the client requests that no history be sent. The client receives the truncation message and no history</li>
  107. </ul>
  108. <example caption="Romeo receives annotated message while in room" ><![CDATA[
  109. <message
  110. to='romeo@montague.lit/lane'
  111. from='orchard@chat.capulet.lit/Juliet'
  112. type='groupchat'>
  113. <body>Ay me!</body>
  114. <presence-session xmlns="urn:xmpp:presence-session:0" session="u8e8t2thu" id="893ou22"/>
  115. </message>
  116. ]]></example>
  117. <p>When sending broadcast messages from the room, the service MUST annotate them with a presence-session stanza with xmlns "urn:xmpp:presence-session:0" and session and id attributes as defined above for presence stanzas.</p>
  118. <example caption="Room informs Romeo's client that it will not transmit the full missing history" ><![CDATA[
  119. <message
  120. to='romeo@montague.lit/lane'
  121. from='orchard@chat.capulet.lit'
  122. type='groupchat'>
  123. <presence-session xmlns="urn:xmpp:presence-session:0" type="truncated"/>
  124. </message>
  125. ]]></example>
  126. <p>When the room does not send the full history of all messages that the client has not received, it MUST (prior to sending any history and subsequent to sending presence) send a message stanza with a payload whose name is 'presence-session' and namespace is "urn:xmpp:presence-session:0" with an attribute named "type" whose value is "truncated". This lets the client know that it is missing history and it could choose to display this to the user in some way.</p>
  127. </section2>
  128. </section1>
  129. <!--<section1 topic='Business Rules' anchor='rules'>
  130. <ul>
  131. <li>.</li>
  132. </ul>
  133. </section1>-->
  134. <!--<section1 topic='Implementation Notes' anchor='impl'>
  135. <p>OPTIONAL.</p>
  136. </section1>
  137. <section1 topic='Accessibility Considerations' anchor='access'>
  138. <p>OPTIONAL.</p>
  139. </section1>
  140. <section1 topic='Internationalization Considerations' anchor='i18n'>
  141. <p>OPTIONAL.</p>
  142. </section1>-->
  143. <section1 topic='Security Considerations' anchor='security'>
  144. <p>This specification doesn't add additional security considerations beyond those of its dependencies..</p>
  145. </section1>
  146. <section1 topic='IANA Considerations' anchor='iana'>
  147. <p>None.</p>
  148. </section1>
  149. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  150. <p>Needs a namespace.</p>
  151. </section1>
  152. <section1 topic='XML Schema' anchor='schema'>
  153. <p>When advanced.</p>
  154. </section1>
  155. </xep>