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-0304.xml 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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>Whitespace Keepalive Negotiation</title>
  10. <abstract>This specification defines a method for negotiating how to send keepalives in XMPP.</abstract>
  11. &LEGALNOTICE;
  12. <number>0304</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. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>NOT_YET_ASSIGNED</shortname>
  23. <author>
  24. <firstname>Ming</firstname>
  25. <surname>Ji</surname>
  26. <email>mingj@cisco.com</email>
  27. <jid>mingj@cisco.com</jid>
  28. </author>
  29. <revision>
  30. <version>0.1</version>
  31. <date>2011-08-18</date>
  32. <initials>psa</initials>
  33. <remark><p>Initial published version.</p></remark>
  34. </revision>
  35. <revision>
  36. <version>0.0.1</version>
  37. <date>2011-07-19</date>
  38. <initials>mj</initials>
  39. <remark><p>First draft.</p></remark>
  40. </revision>
  41. </header>
  42. <section1 topic='Introduction' anchor='intro'>
  43. <p>&rfc6120; specifies that XMPP servers and clients can send whitespace characters between first-level elements of an XML stream as a way to maintain the state of the stream. These "whitespace keepalives" are widely used on the XMPP network. However, currently it is not possible to negotiate the frequency of sending keepalives, or even whether to send keepalives at all (the server simply sends them according to its own schedule). Because certain kinds of devices might not want to use keepalives, or might wish to receive keepalives more frequently or less frequently than the server's default, this specification defines a method for negotiating how to send whitespace keepalives between an XMPP server and an XMPP client (this method could also be used between two servers, although that usage is expected to be rare).</p>
  44. </section1>
  45. <section1 topic='Protocol' anchor='protocol'>
  46. <p>The protocol defined in this document enables a client negotiate the time interval between whitespace keepalives, within a range determined by the server. Normally, the client starts the negotiation since not all kinds of the client support the feature.</p>
  47. <p>The protocol defines a keepalive element and the normal negotaition process is quite simple, demonstrated as following:</p>
  48. <ol start='1'>
  49. <li>Server announces keepalive feature with a range of time intervals.</li>
  50. <li>Client starts the keepalive negotiation by specifying a time interval. </li>
  51. <li>Server checks the value and relpies with success or failure.</li>
  52. </ol>
  53. <p>Then server and client send whitespace keepalive to each other at the agreed time interval.</p>
  54. </section1>
  55. <section1 topic='Use Cases' anchor='usecases'>
  56. <section2 topic='Stream Feature' anchor='feature'>
  57. <p>During the stream negotiation process, the server can advertise this feature. The feature is negotiated after the resource binding. (See &xep0170; regarding the recommended order of stream feature negotiation.)</p>
  58. <example caption='Server lists feature in the stream negotiation stage'><![CDATA[
  59. C: <stream:stream
  60. to='example.com'
  61. version='1.0'
  62. xmlns='jabber:client'
  63. xmlns:stream='http://etherx.jabber.org/streams'>
  64. C: <stream:stream
  65. from='example.com'
  66. id='KskA2O2BEn5mL7mABTq9X3DTPHO44vAMaIg1nG9O1vo'
  67. version='1.0'
  68. xmlns='jabber:client'
  69. xmlns:stream='http://etherx.jabber.org/streams'>
  70. S: <stream:features>
  71. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
  72. <keepalive xmlns='urn:xmpp:keepalive:0'>
  73. <interval min='60' max='300'/>
  74. </keepalive>
  75. </stream:features>
  76. ]]></example>
  77. </section2>
  78. <section2 topic='Negotiate Keepalive' anchor='negotiate'>
  79. <p>Client negotiates the keepalive feature by providing an interval value based on server limits and its own condition. The interval SHOULD be a positive interger, and zero is invalid.</p>
  80. <example caption='Client sends its negotiating keepalive time interval'><![CDATA[
  81. <iq from='client@example.com/foo' id='p03ns61g' to='example.com' type='set'>
  82. <keepalive xmlns='urn:xmpp:keepalive:0'>
  83. <interval>60</interval>
  84. </keepalive>
  85. </iq>
  86. ]]></example>
  87. <p>The server checks the keepalive interval value and returns a success:</p>
  88. <example caption='Server returns success of keepalive negotiation'><![CDATA[
  89. <iq from='example.com' id='p03ns61g' to='client@example.com/foo' type='result'/>
  90. ]]></example>
  91. <p>If a problem occurs, the server returns an error (in this example, the client sent a value outside the range of the server's preferences):</p>
  92. <example caption='Server returns failure of keepalive negotiation'><![CDATA[
  93. <iq from='example.com' id='p03ns61g' to='client@example.com/foo' type='error'>
  94. <error type='cancel'>
  95. <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  96. </error>
  97. </iq>
  98. ]]></example>
  99. <p>Then both the server and the client send whitespace keepalives at the interval of the negotiated value. The server SHOULD check to see if has received keepalives and MAY drop the connection if it has not received a keepalive for a period of time significantly longer than the negotiated value (the client MAY also implement this behavior).</p>
  100. </section2>
  101. </section1>
  102. <section1 topic='Implementation Notes' anchor='impl'>
  103. <p>Several things need to be noted:</p>
  104. <ol start='1'>
  105. <li>Both parties SHOULD keep a record of the keepalive status and honor the negotiated value when allowing stream resumption and session recreation. See &xep0198;</li>
  106. <li>The length of the keepalive interval depends on the service type and network environment. Implementations are encouraged to use appropriate values based on implementation and deployment experience.</li>
  107. </ol>
  108. </section1>
  109. <section1 topic='Security Considerations' anchor='security'>
  110. <p>During negotiation, the server MUST check the keepalive interval value and reject any invalid values.</p>
  111. </section1>
  112. <section1 topic='IANA Considerations' anchor='iana'>
  113. <p>This document requires no interaction with &IANA;.</p>
  114. </section1>
  115. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  116. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  117. <p>The &REGISTRAR; is requested to issue an initial namespace 'urn:xmpp:keepalive:0'</p>
  118. </section2>
  119. <section2 topic='Stream Features' anchor='registrar-stream'>
  120. <p>The &REGISTRAR; is requested to issue an initial stream feature namespace 'urn:xmpp:keepalive:0'.</p>
  121. </section2>
  122. </section1>
  123. <section1 topic='XML Schema' anchor='schema'>
  124. <code><![CDATA[
  125. <?xml version='1.0' encoding='utf-8'?>
  126. <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'
  127. targetNamespace='urn:xmpp:keepalive:0'
  128. xmlns='urn:xmpp:keepalive:0'
  129. elementFormDefault='unqualified'>
  130. <xsd:element name='keepalive'>
  131. <xsd:complexType>
  132. <xsd:attribute name='min' type='positiveShort' use='optional'/>
  133. <xsd:attribute name='max' type='positiveShort' use='optional'/>
  134. <xsd:assert test='@min le @max'/>
  135. <xsd:element name='interval' type='positiveShort' minOccurs='0' maxOccurs='1'/>
  136. </xsd:complexType>
  137. </xsd:element>
  138. <xsd:simpleType name='positiveShort'>
  139. <xsd:restriction base='xsd:unsignedShort'>
  140. <xsd:minExclusive value='0'/>
  141. </xsd:restriction>
  142. </xsd:simpleType>
  143. </xsd:schema>
  144. ]]></code>
  145. </section1>
  146. <section1 topic='Acknowledgements' anchor='ack'>
  147. <p>Thanks to Matt Miller and Peter Saint-Andre for their feedback.</p>
  148. </section1>
  149. </xep>