%ents; ]>
XMPP Over BOSH This specification defines how the Bidirectional-streams Over Synchronous HTTP (BOSH) technology can be used to transport XMPP stanzas. The result is an HTTP binding for XMPP communications that is useful in situations where a device or client is unable to maintain a long-lived TCP connection to an XMPP server. &LEGALNOTICE; 0206 Draft Standards Track Standards Council XMPP Core XEP-0124 xbosh http://www.xmpp.org/schemas/xbosh.xsd &ianpaterson; &stpeter; 1.2rc3 in progress, last updated 2008-10-28 psa

Clarified handling of xmpp:restart -- client MUST send the restart and the body MUST be empty; removed IM session establishment examples because that protocol is deprecated in rfc3921bis; corrected XML schema.

1.1 2007-06-04 ip

remote-stream-error includes full <stream:error/> element (not just its content) and optional stanzas

1.0 2007-02-28 ip

Initial version (extracted from XEP-0124 version 1.5); deprecated non-SASL authentication and authid attribute; multiple clarifications and restructuring without changes to protocol itself; added optional version and restart attributes.

The &xep0124; protocol defines how arbitrary XML elements can be transported efficiently and reliably over HTTP in both directions between a client and server. This document defines some minor extensions to BOSH that enable XMPP streams (as specified in &rfc3920; and &rfc3921;) to be bound to HTTP.

If the BOSH <body/> wrapper is not empty, then it SHOULD contain one of the following:

Note: Many existing XMPP-specific implementations of BOSH clients and connection managers do not specify the namespace of <message/>, <presence/>, or <iq/> elements, since that allows them to forward stanzas without modification (the XMPP <stream:stream/> wrapper element used with TCP typically sets the default namespace to 'jabber:client'). They instead simply assume that the full content of the 'jabber:client' namespace is a subset of the 'http://jabber.org/protocol/httpbind' namespace.

Note: Inclusion of TLS negotiation elements is allowed but is NOT RECOMMENDED. The definition of how TLS might be implemented over BOSH is currently beyond the scope of this document. Instead, channel encryption SHOULD be completed at the HTTP (transport) layer, not the XMPP (application) layer.

The client SHOULD include an 'xmpp:version' attribute qualified by the 'urn:xmpp:xbosh' namespace in its session creation request. This attribute corresponds to the 'version' attribute of the XMPP <stream:stream/> element as defined in RFC 3920. The connection manager SHOULD forward the value to the XMPP server accordingly.

]]>

Note: Unlike the protocol defined in &xep0025;, an opening <stream:stream> tag is not sent to the connection manager (since BOSH <body/> elements MUST not contain partial XML elements). Any XML streams between the connection manager and an XMPP server are the responsibility of the connection manager (and beyond the scope of this document).

The connection manager SHOULD include an 'xmpp:version' attribute (qualified by the 'urn:xmpp:xbosh' namespace) and a <stream:features/> element (qualified by the 'http://etherx.jabber.org/streams' namespace) in a response as soon as they are available, either in its session creation response, or (if it has not yet received them from the XMPP server) in any subsequent response. If no <stream:features/> element is included in the connection manager's session creation response, then the client SHOULD send empty request elements until it receives a response containing a <stream:features/> element.

Note: The same procedure applies to the deprecated XMPP-specific 'authid' attribute of the BOSH <body/> element, which contains the value of the XMPP stream ID generated by the XMPP server. This value is needed only by legacy XMPP clients in order to complete digest authentication using the deprecated &xep0078; protocol. Separate 'sid' and 'authid' attributes are required because the connection manager is not necessarily part of a single XMPP server (e.g., it may handle HTTP connections on behalf of multiple XMPP servers).

DIGEST-MD5 PLAIN ]]> DIGEST-MD5 PLAIN ]]>

Note: The client SHOULD ignore any Transport Layer Security (TLS) feature since BOSH channel encryption SHOULD be negotiated at the HTTP layer.

TLS compression (as defined in RFC 3920) and Stream Compression (as defined in &xep0138;) are NOT RECOMMENDED since compression SHOULD be negotiated at the HTTP layer using the 'accept' attribute of the BOSH session creation response. TLS compression and Stream Compression SHOULD NOT be used at the same time as HTTP content encoding.

Note: The 'xmpp:version' attribute SHOULD also be included on the request and response when adding new streams to a session.

A success case for authentication and resource binding using the XMPP protocols is shown below. For detailed specification of these protocols (including error cases), refer to RFC 3920.

]]> cmVhbG09InNvbWVyZWFsbSIsbm9uY2U9Ik9BNk1HOXRFUUdtMmhoIixxb3A9 ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNzCg== ]]> dXNlcm5hbWU9InNvbWVub2RlIixyZWFsbT0ic29tZXJlYWxtIixub25jZT0i T0E2TUc5dEVRR20yaGgiLGNub25jZT0iT0E2TUhYaDZWcVRyUmsiLG5jPTAw MDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZXhhbXBsZS5jb20i LHJlc3BvbnNlPWQzODhkYWQ5MGQ0YmJkNzYwYTE1MjMyMWYyMTQzYWY3LGNo YXJzZXQ9dXRmLTgK ]]> cnNwYXV0aD1lYTQwZjYwMzM1YzQyN2I1NTI3Yjg0ZGJhYmNkZmZmZAo= ]]> ]]> ]]>

Upon receiving the <success/> element, the client MUST then ask the connection manager to restart the stream by sending a "restart request" that is structured as follows:

The following example illustrates the format for a restart request.

]]>

Upon receiving a restart request, the connection manager MUST consider the previous stream with the XMPP server to be closed. It MUST then initiate a new stream by sending an opening <stream:stream> tag over the same TCP connection to the XMPP server. If the connection manager receives a <stream:features/> element from the XMPP server, it MUST forward that element to the client:

]]>

The client can then complete any mandatory or discretionary stream feature negotiations.

httpclient ]]> stpeter@jabber.org/httpclient ]]>

The content of the <body/> element is zero or more stanzas followed by a copy of the <stream:error/> element Earlier obsolete versions of this protocol specified that the <body/> element should contain only the content of the <stream:error/> element. (qualified by the 'http://etherx.jabber.org/streams' namespace) received from the XMPP server:

I said "Hi!" Some special application diagnostic information! ]]>

It is possible that a connection manager will receive a stanza for delivery to a client even though the client connection is no longer active (e.g., before the connection manager is able to inform the XMPP server that the connection has died). In this case, the connection manager would return an error to the XMPP server; it is RECOMMENDED that the connection manager proceed as follows, since the situation is similar to that addressed by point #2 of Section 11.1 of RFC 3921:

  1. If the delivered stanza was &PRESENCE;, silently drop the stanza and do not return an error to the sender.
  2. If the delivered stanza was &IQ;, return a &unavailable; error to the sender.
  3. If the delivered stanza was &MESSAGE;, return a &recipient; error to the sender.

When an XMPP server receives a &MESSAGE; stanza of type "error" containing a &recipient; condition from a connection manager, it SHOULD store the message for later delivery if offline storage is enabled (see &xep0160;), otherwise route the error stanza to the sender.

This protocol does not introduce any new security considerations beyond those specified in BOSH and XMPP Core.

This document requires no interaction with &IANA;.

The ®ISTRAR; includes 'urn:xmpp:xbosh' in its registry of protocol namespaces.

The protocol documented by this schema is defined in XEP-0206: http://www.xmpp.org/extensions/xep-0206.html name='bosh:body'> ]]>