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-0352.xml 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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>Client State Indication</title>
  10. <abstract>This document defines a way for the client to indicate its active/inactive state.</abstract>
  11. &LEGALNOTICE;
  12. <number>0352</number>
  13. <status>Proposed</status>
  14. <lastcall>2017-12-21</lastcall>
  15. <lastcall>2017-11-15</lastcall>
  16. <lastcall>2017-03-28</lastcall>
  17. <lastcall>2017-03-01</lastcall>
  18. <lastcall>2017-02-22</lastcall>
  19. <lastcall>2015-09-07</lastcall>
  20. <type>Standards Track</type>
  21. <sig>Standards</sig>
  22. <approver>Council</approver>
  23. <dependencies>
  24. <spec>XMPP Core</spec>
  25. </dependencies>
  26. <supersedes/>
  27. <supersededby/>
  28. <shortname>csi</shortname>
  29. &mwild;
  30. <revision>
  31. <version>0.2.1</version>
  32. <date>2017-02-18</date>
  33. <initials>fs</initials>
  34. <remark><p>Clarify that the CSI state is not restored when the stream is resumed.</p></remark>
  35. </revision>
  36. <revision>
  37. <version>0.2</version>
  38. <date>2015-10-02</date>
  39. <initials>XEP Editor (mam)</initials>
  40. <remark><p>Clarified how CSI is affected by in-order processing (Florian Schmaus).</p></remark>
  41. </revision>
  42. <revision>
  43. <version>0.1</version>
  44. <date>2014-08-28</date>
  45. <initials>XEP Editor (asw)</initials>
  46. <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  47. </revision>
  48. <revision>
  49. <version>0.0.1</version>
  50. <date>2014-08-14</date>
  51. <initials>mw</initials>
  52. <remark><p>First draft.</p></remark>
  53. </revision>
  54. </header>
  55. <section1 topic='Introduction' anchor='intro'>
  56. <p>It is common for IM clients to be logged in and 'online' even while the user is not interacting with the application. This
  57. protocol allows the client to indicate to the server when the user is not actively using the client, allowing the server to
  58. optimise traffic to the client accordingly. This can save bandwidth and resources on both the client and server.</p>
  59. </section1>
  60. <section1 topic='Requirements' anchor='reqs'>
  61. <p>The aim of this specification is to provide a simple and efficient protocol for the client to report its
  62. state to the server. Exactly how the server uses this information is beyond the scope of this document, although
  63. some examples are given.</p>
  64. <p>Other extensions exist, such as &xep0273;, which also aim to optimise the traffic between the client and server.
  65. A notable difference is that instead of being client-controlled, CSI shifts the responsibility to the server, and
  66. aims to just provide the server with enough information to implement various optimisations itself.</p>
  67. </section1>
  68. <section1 topic='Use Cases' anchor='usecases'>
  69. <section2 topic='User and client behaviour' anchor='behaviour-user'>
  70. <p>Juliet has an XMPP client on her phone, which is available to receive messages. However most of the time
  71. Juliet has her phone screen turned off and is not interested in the status of her contacts unless they are
  72. communicating with her.</p>
  73. <p>Juliet's client informs the server when Juliet is not interacting with it. The server uses this information to
  74. suppress or reduce stanzas that are unimportant, such as status updates.</p>
  75. <p>When Juliet returns to her IM client, the client again informs the server, this time to report that it is active
  76. again. The server then disables its traffic optimisations and restores the stream to its normal state.</p>
  77. </section2>
  78. <section2 topic="Server behaviour">
  79. <p>When the server knows that the user is not engaging with their client many optimisations become possible. For
  80. example a server could:</p>
  81. <ul>
  82. <li>Suppress presence updates until the client becomes active again. On becoming active, push the latest
  83. presence from each contact.</li>
  84. <li>Discard messages containing only &xep0085; payloads.</li>
  85. <li>Defer or discard unimportant PEP notifications, possibly unsubscribe from certain PEP nodes
  86. until the client becomes active again.</li>
  87. </ul>
  88. <p>This list is for example only, a server is not required to implement all or any of these, nor is it prevented
  89. from implementing other behaviour not listed here. Regardless of what optimisations a server implements, it SHOULD
  90. provide a way for administrators to configure them, and MAY provide such configuration to users also (e.g., through an
  91. ad-hoc command).</p>
  92. </section2>
  93. </section1>
  94. <section1 topic="Protocol" anchor="protocol">
  95. <section2 topic="Discovering support" anchor="discovery">
  96. <p>If the server supports CSI, it advertises it in the stream features after the client has authenticated:</p>
  97. <example caption='Server indicates support for CSI'><![CDATA[
  98. <stream:features>
  99. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
  100. <csi xmlns='urn:xmpp:csi:0'/>
  101. </stream:features>
  102. ]]></example>
  103. </section2>
  104. <section2 topic="Indicating state" anchor="indication">
  105. <p>A stream always begins in 'active' state. If a client wishes to inform the server that it has become inactive,
  106. it sends an &lt;inactive/&gt; element in the 'urn:xmpp:csi:0' namespace:</p>
  107. <example caption='Client indicates it is inactive'><![CDATA[
  108. <inactive xmlns='urn:xmpp:csi:0'/>
  109. ]]></example>
  110. <p>As might be anticipated, when the client is active again it sends an &lt;active/&gt; element:</p>
  111. <example caption='Client indicates it is active'><![CDATA[
  112. <active xmlns='urn:xmpp:csi:0'/>
  113. ]]></example>
  114. <p>There is no reply from the server to either of these elements (though they may indirectly cause the server to
  115. send stanzas, e.g., to update presence information when the client becomes active after a period of inactivity).</p>
  116. </section2>
  117. </section1>
  118. <section1 topic='Business Rules' anchor='rules'>
  119. <p>As this protocol is for indication only, clients MUST NOT make assumptions about how the server
  120. will use the active/inactive state information.</p>
  121. <p>The server MUST assume all clients to be in the 'active' state until the client indicates otherwise. Also the
  122. CSI active/inactive state is unrelated to the user's presence, the server MUST treat the two independently.</p>
  123. <p>This protocol is intended primarily for clients with human interaction. Due to the open-ended nature of
  124. the possible optimisations implemented by the server, it may not be suitable for non-IM purposes where the
  125. fully standard behaviour of XMPP is required.</p>
  126. <section2 topic="In-order processing" anchor="in-order-processing">
  127. <p>
  128. XMPP requires stanzas to be processed in order as per &rfc6120; 10.1. Especially "If the server's processing of a particular request could have an effect on its processing of subsequent data it might receive over that input stream..., it MUST suspend processing of subsequent data until it has processed the request.". As a result, all actions triggered by a CSI nonza sent to the server must happen before processing further requests from the same client to the server.
  129. </p>
  130. <p>
  131. For example: A client sends a CSI active nonza, followed by an XMPP Ping request to the server. The server first changes the CSI state to active and flushes all eventually queued stanzsa. After the state has been restored to 'active' and
  132. all resulting stanzas have been put on the wire, the
  133. server sends the pong.
  134. </p>
  135. <example caption='In-order processing'><![CDATA[
  136. <!-- Client sends 'active' and a ping to the server -->
  137. <active xmlns='urn:xmpp:csi:0'/>
  138. <iq to='capulaet.lit' from='juliet@capulet.lit/balcony' id='ping1' type='get'>
  139. <ping xmlns='urn:xmpp:ping'/>
  140. </iq>
  141. <!-- Server restores stream state to active,
  142. e.g. by flushing out queued stanzas to the client.
  143. and responds to the ping with a pong -->
  144. <iq to='juliet@capulet.lit/baclony' from='capulet.lit' id='ping1' type='result'/>
  145. <!-- Stream state is now 'active' -->]]></example>
  146. </section2>
  147. <section2 topic='Interaction with Stream Resumption' anchor='stream-resumption'>
  148. <p>After a previous stream was resumed using mechanisms like
  149. &xep0198;, the CSI state is <em>not</em> restored. That is, stream
  150. resumption does not affect the current CSI state, which always
  151. defaults to 'active' for new and resumed streams. Clients wishing
  152. to immediately go to the inactive state should do so after stream
  153. resumption.</p>
  154. </section2>
  155. </section1>
  156. <section1 topic='Security Considerations' anchor='security'>
  157. <p>To protect the privacy of users, servers MUST NOT reveal the clients active/inactive state to other
  158. entities on the network.</p>
  159. </section1>
  160. <section1 topic='IANA Considerations' anchor='iana'>
  161. <p>This document requires no interaction with &IANA;.</p>
  162. </section1>
  163. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  164. <p>This document requires no interaction with &REGISTRAR;.</p>
  165. </section1>
  166. <section1 topic='XML Schema'>
  167. <code><![CDATA[
  168. <?xml version='1.0' encoding='UTF-8'?>
  169. <xs:schema
  170. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  171. targetNamespace='urn:xmpp:csi:0'
  172. xmlns='urn:xmpp:csi:0'
  173. elementFormDefault='qualified'>
  174. <xs:element name='csi' type='empty'/>
  175. <xs:element name='active' type='empty'/>
  176. <xs:element name='inactive' type='empty'/>
  177. <xs:simpleType name='empty'>
  178. <xs:restriction base='xs:string'>
  179. <xs:enumeration value=''/>
  180. </xs:restriction>
  181. </xs:simpleType>
  182. </xs:schema>
  183. ]]></code>
  184. </section1>
  185. <section1 topic='Acknowledgements' anchor='acknowledgements'>
  186. <p>Thanks to Florian Schmaus for his feedback.</p>
  187. </section1>
  188. </xep>