From c396e02073ceab9935c07dfbbc7283ce3710a520 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Tue, 17 Jan 2017 09:18:52 -0600 Subject: [PATCH] Add "Bind 2.0" to the inbox Squashed commit of the following: commit e8b5dc6385c523661bd5f335ccb442b8904af1f8 Author: Kevin Smith Date: Tue Jan 17 09:43:32 2017 +0000 Tidy up some text ready for submission commit 055b02896f34920cb99879ebb366f757c1af20fb Author: Kevin Smith Date: Thu Dec 15 12:21:17 2016 +0000 Add strawman protocol commit 5b2910208180e9a92a3a757ece6e129d2ffe360f Author: Kevin Smith Date: Thu Dec 15 12:03:59 2016 +0000 Advertise support commit 840808df0f3baf59f9c30570c427c2bca69841b2 Author: Kevin Smith Date: Mon Dec 12 11:07:36 2016 +0000 Add basic requirements commit 3ff672b20718c298424f681ca057506978c190a3 Author: Kevin Smith Date: Fri Dec 9 15:18:13 2016 +0000 Add introduction for bind 2.0 --- inbox/bind2.0.xml | 116 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 inbox/bind2.0.xml diff --git a/inbox/bind2.0.xml b/inbox/bind2.0.xml new file mode 100644 index 00000000..0401ebca --- /dev/null +++ b/inbox/bind2.0.xml @@ -0,0 +1,116 @@ + + +%ents; +]> + + +
+ Bind 2.0 + This specification provides a single-request replacement for several activities an XMPP client needs to do at startup. + &LEGALNOTICE; + xxxx + ProtoXEP + Standards Track + Standards + Council + + XMPP Core + XMPP IM + XEP-0313 + XEP-0280 + + + + NOT_YET_ASSIGNED + &ksmithisode; + + 0.0.1 + 2016-12-09 + ks +

First draft.

+
+
+ +

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.

+

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.

+

The returning of unread message state to the client relies on the archive having these data, which is a topic for another specification.

+
+ +
    +
  • Allow MAM synchronisation and Carbons enabling without a race condition leading to missed or duplicated stanzas
  • +
  • Avoid offline messages being received by clients using the MAM archive for message retrieval
  • +
  • Allow clients to know which messages are unread in the archive, providing a cross-client alternative to offline messages
  • +
  • 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)
  • +
+
+ + +

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'.

+ + + + + +]]> +
+ + +

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@)

+ +]]> +

When it receives a bind 2.0 on an authenticated not-yet-bound session, the server MUST:

+
    +
  • Clear the offline messages for this user, if any, without sending them (as they will be provided by MAM).
  • +
  • Perform resource binding to a random resource (see 6120)
  • +
  • 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
  • +
  • Get the id of the newest stanza in the user's MAM archive
  • +
  • Silently enable carbons for this session
  • +
+

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

+ + nurse@shakespeare.lit/abtet29a9fu + balisoseb + + + + + +]]> +
+ + +

A server supporting this specification MUST allow the following initial commands to be pipelined:

+
    +
  • Initial client stream header
  • +
  • SASL Authentication*
  • +
  • Post-authentication stream header
  • +
  • Bind 2.0
  • +
+

[ * 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]

+

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.

+

Note: also enable acks? discuss on standards@

+
+
+ + +

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.

+
+ +

None.

+
+ +

The urn:xmpp:bind2:0 namespace must be registered..

+
+ +