| Abstract: | This specification defines an extension to BOSH that allows multiple clients to share the same underlying XMPP connection. |
| Author: | Jack Moffitt |
| Copyright: | © 1999 - 2009 XMPP Standards Foundation. SEE LEGAL NOTICES. |
| Status: | ProtoXEP |
| Type: | Standards Track |
| Version: | 0.0.1 |
| Last Updated: | 2009-05-13 |
WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <http://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
1. Introduction
2. Requirements
3. Protocol Flow
4. Use Cases
4.1. Creating a Sharable Connection
4.2. Attaching to a Shared Connection
5. Inbound Traffic Delivery
6. Security Considerations
6.1. Shared Secrets
6.2. Storage of the Secret
7. IANA Considerations
8. XMPP Registrar Considerations
9. XML Schema
Appendices
A: Document Information
B: Author Information
C: Legal Notices
D: Relation to XMPP
E: Discussion Venue
F: Requirements Conformance
G: Notes
H: Revision History
XMPP-powered applications which run inside of Web browsers typically use BOSH [1] to create a link to an XMPP server. Unfortunately Web applications do not have control over some interactions, such as a user opening a link in a new tab. This means that an application can end up with multiple simultaneous BOSH connections, each of which is a fully addressable XMPP endpoint. Complex applications often need to share some state, and managing this over an arbitrary number of individual connections can be problematic.
This specification defines a mechanism for a connection manager to allow multiple clients to share the same underlying XMPP connection. Additionally, the connection manager will notify all clients of inbound stanzas. Similar functionality exists in specific areas of the XMPP protocol; for example, roster changes are broadcast to all connected resources so each resource can keep roster state synchronized.
As an example, consider an application which is open in two tabs (or two windows) in a Web browser. In the first tab, the application subscribes to some pubsub node it is interested in. The BOSH connection manager would send this subscription request to the other connected clients (in this case, just the second tab) so that they are aware that a subscription has been requested. When the subscription acknowledgement is received by the connection manager, it will broadcast it to all clients.
Shared BOSH must meet the following requirements:
In addition to these, the intention is for this extension to be easy to implement in current BOSH implementations.
In order to establish a sharable connection which is then shared across two clients, the following steps take place. The mechanism for sharing the secret below is just one possible mechanism.
A client can create a sharable BOSH connection by providing the 'shared:key' attribue to the connection manager in the initial <body/> element.
Example 1. Creating the connection
POST /webclient HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip, deflate
Content-Type: text/xml; charset=utf-8
Content-Length: 304
<body content='text/xml; charset=utf-8'
hold='1'
rid='1573741820'
to='example.com'
ver='1.6'
wait='60'
shared:key='3c1d69981b65bfbd641dcb64c82bb613'
xmlns:shared='urn:xmpp:tmp:shared-bosh:0'
xml:lang='en'
xmlns='http://jabber.org/protocol/httpbind'/>
If the connection manager supports sharable connections, it will include the 'shared:result' attribute in its response. Since this is a new sharable connection and not an attachment to an existing sharable connection, the value of the 'shared:result' attribute is 'created'.
Example 2. Sharable connection created succesfully
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 354
<body wait='60'
inactivity='30'
polling='5'
requests='2'
hold='1'
accept='deflate,gzip'
maxpause='120'
sid='d96c53d08d0d7b96d5d4ac0e402424ab'
ver='1.6'
from='example.com'
shared:result='created'
xmlns:shared='urn:xmpp:tmp:shared-bosh:0'
xmlns='http://jabber.org/protocol/httpbind'/>
If the connection manager does not support this extension, it will ignore the 'shared:key' attribute and will not include one in its response.
Attaching to a connection is performed in the same manner as creating a sharable connection. The client provides the secret key of an existing connection as the value of the 'shared:key' attribute. If the key matches, the connection manager will respond with a 'shared:result' attribute with a value of 'attached'.
Example 3. Attached to a Shared Connection
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 355
<body wait='60'
inactivity='30'
polling='5'
requests='2'
hold='1'
accept='deflate,gzip'
maxpause='120'
sid='d96c53d08d0d7b96d5d4ac0e402424ab'
ver='1.6'
from='example.com'
shared:result='attached'
xmlns:shared='urn:xmpp:tmp:shared-bosh:0'
xmlns='http://jabber.org/protocol/httpbind'/>
In order to easily maintain state across shared BOSH clients, the connection manager must deliver inbound traffic to the server from one client to all the other clients sharing the connection. Applications which use shared connections must be written so that they can deal with this extra traffic; they cannot assume that all stanzas received are outbound.
In order to protect against unauthorized or unintended connection sharing, this specification uses a shared secret. It is important that this secret be hard to guess and long enough that it is resistant to brute force attack.
It is necessary for a client to communicate the shared secret to the other clients. Since Web browser security policy prevents most ways of achieving this, it is necessary to store the secret somewhere the other clients can find this. Implementors must be care that this storage is robust to attack.
Two options are recommended for secret storage:
Generate the secret on the server side (for example, in the Web application framework that generates your HTML pages). Please note that the secret should not be transmitted alongside the HTML as this would allow anyone reading the HTML to share the connection. Instead, the BOSH connection should be bootstrapped before page delivery.
Generate the secret on the client side, and store it within the XMPP server using some available mechanism. For example, a client could use Private XML Storage [2] or a private Personal Eventing Protocol [3] node.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [4].
This XEP proposes the namespace 'urn:xmpp:tmp:shared-bosh:0' be added to the registry.
To follow.
Series: XEP
Number: xxxx
Publisher: XMPP Standards Foundation
Status:
ProtoXEP
Type:
Standards Track
Version: 0.0.1
Last Updated: 2009-05-13
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0124, XEP-0206
Supersedes: None
Superseded By: None
Short Name: NOT_YET_ASSIGNED
Email:
jack@metajack.im
JabberID:
metajack@gmail.com
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <editor@xmpp.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
1. XEP-0124: Bidirectional-streams Over Synchronous HTTP <http://xmpp.org/extensions/xep-0124.html>.
2. XEP-0049: Private XML Storage <http://xmpp.org/extensions/xep-0049.html>.
3. XEP-0163: Personal Eventing Protocol <http://xmpp.org/extensions/xep-0163.html>.
4. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
First draft.
(Jack)END