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-0386.xml 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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>Bind 2.0</title>
  10. <abstract>This specification provides a single-request replacement for several activities an XMPP client needs to do at startup.</abstract>
  11. &LEGALNOTICE;
  12. <number>0386</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-0313</spec>
  21. <spec>XEP-0280</spec>
  22. </dependencies>
  23. <supersedes/>
  24. <supersededby/>
  25. <shortname>bind2</shortname>
  26. &ksmithisode;
  27. <revision>
  28. <version>0.2.0</version>
  29. <date>2018-02-08</date>
  30. <initials>XEP Editor (jc)</initials>
  31. <remark>Defer due to lack of activity.</remark>
  32. </revision>
  33. <revision>
  34. <version>0.1.0</version>
  35. <date>2017-02-08</date>
  36. <initials>XEP Editor: ssw</initials>
  37. <remark><p>First draft accepted by the XMPP Council.</p></remark>
  38. </revision>
  39. </header>
  40. <section1 topic='Introduction' anchor='intro'>
  41. <p>As XMPP has grown more feature-rich over time, more steps have been introduced that clients are likely to perform at startup, e.g. resource binding, archive synchronisation, enabling Carbons. Some of these introduce race conditions - e.g. if a client synchronises the archive before enabling Carbons, it can miss stanzas sent between these events, or if it enables Carbons before synchronising the archive it can receive duplicate messages. It may also cause duplicate messages by combining archive synchronisation and receipt of offline messages, or by receipt of messages addressed to the full JID between resource binding and archive synchronisation. This document provides a mechanism for atomically performing these operations to avoid these race conditions. It also provides information to a client that is generally useful about the state of the archive.</p>
  42. <p>There have been other (not-yet documented) suggestions of further enhancements to the stream startup process, and it is possible that in the future some protocol here may be reframed in terms of such new facilities, but the core premise of the XEP (that these features are needed, and need enabling together) remains. It may be desirable to make the enabling of features extensible, such that the client can request which features are needed, together, but the current approach should serve as a suitable basis for discussion.</p>
  43. <p>The returning of unread message state to the client relies on the archive having these data, which is a topic for another specification.</p>
  44. </section1>
  45. <section1 topic='Requirements' anchor='reqs'>
  46. <ul>
  47. <li>Allow MAM synchronisation and Carbons enabling without a race condition leading to missed or duplicated stanzas</li>
  48. <li>Avoid offline messages being received by clients using the MAM archive for message retrieval</li>
  49. <li>Allow clients to know which messages are unread in the archive, providing a cross-client alternative to offline messages</li>
  50. <li>Avoid clients receiving 'live' messages until they have synchronised their state from the server (to avoid double-receipt of messages, one from the archive one live)</li>
  51. </ul>
  52. </section1>
  53. <section1 topic='Use Cases' anchor='usecases'>
  54. <section2 topic='Discovering support'>
  55. <p>A client does not advertise support for bind 2.0. If a server supports bind 2.0, it MUST advertise this in the stream features with an feature named 'bind' in the namespace 'urn:xmpp:bind2:0'.</p>
  56. <example caption='Server advertises support in stream features'><![CDATA[
  57. <stream:features>
  58. <bind xmlns='urn:xmpp:bind2:0'/>
  59. <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
  60. <sm xmlns='urn:xmpp:sm:3'/>
  61. </stream:features>
  62. ]]></example>
  63. </section2>
  64. <section2 topic='Performing the bind'>
  65. <p>After authentication, a client performs a bind 2.0 by sending an element 'bind' in the samespace 'urn:xmpp:bind2:0'. (Note: this gets rid of manual resource binding altogether. For discussion on standards@)</p>
  66. <example caption='Client initiates a bind 2.0'><![CDATA[
  67. <bind xmlns='urn:xmpp:bind2:0'/>
  68. ]]></example>
  69. <p>When it receives a bind 2.0 on an authenticated not-yet-bound session, the server MUST:</p>
  70. <ul>
  71. <li>Clear the offline messages for this user, if any, without sending them (as they will be provided by MAM).</li>
  72. <li>Perform resource binding to a random resource (see 6120)</li>
  73. <li>Work out which contacts have unread messages in the user's MAM archive, how many, and what the id of the last read message is</li>
  74. <li>Get the id of the newest stanza in the user's MAM archive</li>
  75. <li>Silently enable carbons for this session</li>
  76. </ul>
  77. <p>After processing the bind stanza, as above, the server MUST respond with an element of type 'bound' in the namespace 'urn:xmpp:bind2:0', as in the below example</p>
  78. <example caption='Server responds after processing the bind'><![CDATA[
  79. <bound xmlns='urn:xmpp:bind2:0'>
  80. <jid>nurse@shakespeare.lit/abtet29a9fu</jid>
  81. <latest-id>balisoseb</latest-id>
  82. <unreads>
  83. <unread jid='romeo@shakespeare.lit' read-id='onuheuhoeu', unread-count='3'/>
  84. <unread jid='juliet@shakespeare.lit' read-id='koeunhth29', unread-count='43'/>
  85. </unreads>
  86. </bound>
  87. ]]></example>
  88. </section2>
  89. <section2 topic='Pipelining'>
  90. <p>A server supporting this specification MUST allow the following initial commands to be pipelined:</p>
  91. <ul>
  92. <li>Initial client stream header</li>
  93. <li>SASL Authentication*</li>
  94. <li>Post-authentication stream header</li>
  95. <li>Bind 2.0</li>
  96. </ul>
  97. <p>[ * pipelining will clearly not work for multi-stage SASL mechanisms, but the initial stage MUST be capable of being pipelined after the stream header, and the post-authentication stream header MUST be able to be pipelined after the final authentication element]</p>
  98. <p>In this way, a client is able to (if using 'xmpps' for avoiding starttls, to be defined elsewhere), on second and subsequent login cache the presence of bind 2.0 in stream features from a previous session, and pipeline the entire stream initialisation process by sending the stream header, followed by auth, followed by a stream header, followed by a bind 2.0 in a single chunk.</p>
  99. <p>Note: also enable acks? discuss on standards@</p>
  100. </section2>
  101. </section1>
  102. <!--<section1 topic='Business Rules' anchor='rules'>
  103. <p>OPTIONAL.</p>
  104. </section1>
  105. <section1 topic='Implementation Notes' anchor='impl'>
  106. <p>OPTIONAL.</p>
  107. </section1>-->
  108. <section1 topic='Security Considerations' anchor='security'>
  109. <p>This specification is mostly a reworking of existing protocol/features. The additional facility provided here is to provide information on the user's archive; as this facility is provided post-authentication and is only providing the user's data to the user, it doesn't introduce new security considerations.</p>
  110. </section1>
  111. <section1 topic='IANA Considerations' anchor='iana'>
  112. <p>None.</p>
  113. </section1>
  114. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  115. <p>The urn:xmpp:bind2:0 namespace must be registered..</p>
  116. </section1>
  117. <!--<section1 topic='XML Schema' anchor='schema'>
  118. <p>REQUIRED for protocol specifications.</p>
  119. </section1>-->
  120. </xep>