XEP-xxxx: Shared BOSH

Abstract
This specification defines an extension to BOSH that allows multiple clients to share the same underlying XMPP connection.
Author
Jack Moffitt
Copyright
© 2009 – 2009 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

ProtoXEP

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 <https://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
Type
Standards Track
Version
0.0.1 (2009-05-13)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

XMPP-powered applications which run inside of Web browsers typically use BOSH (XEP-0124) [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.

2. Requirements

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.

3. Protocol Flow

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.

  1. Client A initiates a BOSH session and indicates that this session is sharable via the 'shared:key' attribute.
  2. Client A authenticates with the XMPP server and publishes the secret key to a private PEP node.
  3. Client B initiates a BOSH sesion and indicates that this session is sharable via the 'shared:key' attribute.
  4. Client B authenticates with the XMPP server and discovers Client A's existing secret key in the PEP node.
  5. Client B terminates the BOSH connection and initiates a new one, using the discovered secret key as the value of the 'shared:key' attribute in the initial <body/> tag.
  6. The connection manager verifies the key and allows Client B to share Client A's XMPP connection.

4. Use Cases

4.1 Creating a Sharable Connection

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.

4.2 Attaching to a Shared Connection

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

5. Inbound Traffic Delivery

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.

6. Security Considerations

6.1 Shared Secrets

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.

6.2 Storage of the Secret

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:

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

  2. 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 (XEP-0049) [2] or a private Personal Eventing Protocol (XEP-0163) [3] node.

7. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [4].

8. XMPP Registrar Considerations

This XEP proposes the namespace 'urn:xmpp:tmp:shared-bosh:0' be added to the registry.

9. XML Schema

To follow.


Appendices

Appendix A: Document Information

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

This document in other formats: XML  PDF

Appendix B: Author Information

Jack Moffitt
Email
jack@metajack.im
JabberID
metajack@gmail.com

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) 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.

Appendix E: Discussion Venue

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 <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

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

Appendix G: Notes

1. XEP-0124: Bidirectional-streams Over Synchronous HTTP <https://xmpp.org/extensions/xep-0124.html>.

2. XEP-0049: Private XML Storage <https://xmpp.org/extensions/xep-0049.html>.

3. XEP-0163: Personal Eventing Protocol <https://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/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.0.1 (2009-05-13)

    First draft.

    Jack

Appendix I: Bib(La)TeX Entry

@report{moffitt2009xepxxxx,
  title = {Shared BOSH},
  author = {Moffitt, Jack},
  type = {XEP},
  number = {xxxx},
  version = {0.0.1},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-xxxx.html},
  date = {2009-05-13/2009-05-13},
}

END