XEP-0246: End-to-End XML Streams

This specification defines methods for communicating via end-to-end XML streams over a logical or physical connection that provides a reliable transport between two endpoints.
Peter Saint-Andre
© 2008 – 2016 XMPP Standards Foundation. SEE LEGAL NOTICES.


WARNING: This document has been automatically Deferred after 12 months of inactivity in its previous Experimental state. Implementation of the protocol described herein is not recommended for production systems. However, exploratory implementations are encouraged to resume the standards process.
Standards Track
0.1.1 (2016-01-20)
Document Lifecycle
  1. Experimental
  2. Deferred
  3. Proposed
  4. Stable
  5. Final

1. Introduction

XMPP as defined in XMPP Core [1] does not support direct interaction between endpoints, since it requires a client to authenticate an XML stream with a "home" server and send of all of its outbound XML stanzas through that server (which potentially can route those stanzas through a peer server for delivery to the intended recipient). However, in some scenarios it is desirable to establish end-to-end XML streams between two endpoints instead of relying on the standard client-server architecture. These scenarios include:

The first scenario is addressed by Link-Local Messaging (XEP-0174) [2]. The second and third scenarios are addressed by Jingle XML Streams (XEP-0247) [3]. Both of those technologies result in the establishment of a direct or mediated connection between two endpoints, such as a direct TCP connection, a bytestream through SOCKS5 (SOCKS5 Bytestreams (XEP-0065) [4]) or XMPP itself (In-Band Bytestreams (XEP-0047) [5]), or other future transport methods such as RFC 6544 [6].

Once two endpoints have opened a direct or mediated connection, they can establish an XML stream over that connection for end-to-end "("e2e") communication. We call this an "e2e stream".

2. Initiating an e2e Stream

The initiator and recipient essentially follow the process defined in RFC 6120 to establish XML streams between themselves.

First, the initiator opens an XML stream to the recipient over the negotiated transport.

Example 1. Opening a Stream

In accordance with RFC 6120, the initial stream header SHOULD include the 'to' and 'from' attributes. In the case of XEP-0174, these SHOULD be the username@machine-name advertised in the PTR record. In the case of Jingle XML Streams, these SHOULD be the bare JIDs (<localpart@domain.tld> or <domain.tld>) of the entities as communicated via XMPP.

If the initiator supports stream features and the other stream-related aspects of XMPP 1.0 as specified in RFC 6120, then it SHOULD include the version='1.0' flag as shown in the previous example.

The recipient then responds with a stream header as well:

Example 2. Stream Header Response

If both the initiator and recipient included the version='1.0' flag, the recipient SHOULD also send stream features as specified in RFC 6120:

Example 3. Recipient Sends Stream Features
  <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>

3. Stream Encryption

The mere exchange of stream headers results in an unencrypted and unauthenticated channel between the two entities. The entities SHOULD upgrade the channel to an encrypted stream using the XMPP STARTTLS command defined in XMPP Core [1] using RFC 5246 [7], optionally followed by SASL negotiation for mutual authentication (see RFC 4422 [8]).

End-to-end XML streams can be negotiated between two XMPP clients, between an XMPP client and a remote XMPP service (i.e., a service with which a client does not have a direct XML stream, such as a remote Multi-User Chat (XEP-0045) [9] room), or between two remote XMPP services. Therefore, if standard X.509 certificates are used then a party to an e2e XML stream will present either a client certificate or a server certificate as appropriate. If X.509 certificates are used, they MUST at a minimum be generated and validated in accordance with the certificate guidelines guidelines provided in RFC 6120 [1]; however, applications of end-to-end XML streams MAY define supplemental guidelines for certificate validation in the context of particular architectures, such as XEP-0174 for link-local streams and XEP-0247 for direct or mediated streams negotiated through XMPP servers.

To ease the transition from the PGP-based object encryption method specified in Current Jabber OpenPGP Usage (XEP-0027) [10], clients using TLS for e2e streams MAY use the OpenPGP TLS extension defined in RFC 5081 [11] (if available).

Use of other TLS extensions MAY be appropriate as well, including those defined in RFC 5246 [7] and RFC 5054 [12].

4. Exchanging Stanzas

Once the streams are established, either entity then can send XMPP message, presence, and IQ stanzas, with or without 'to' and 'from' addresses.

Example 4. Sending a Message
<message from='romeo@forza' to='juliet@pronto'>
  <body>M'lady, I would be pleased to make your acquaintance.</body>
Example 5. A Reply
<message from='juliet@pronto' to='romeo@forza'>
  <body>Art thou not Romeo, and a Montague?</body>

5. Ending an e2e Stream

To end the stream, either party closes the XML stream:

Example 6. Closing the Stream

The other party then closes the stream in the other direction as well:

Example 7. Closing the Stream

Both parties then SHOULD close the logical or physical connection between them.

6. Security Considerations

End-to-end streams SHOULD be encrypted; see the Stream Encryption section of this document.

7. IANA Considerations

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

8. XMPP Registrar Considerations

This document requires no interaction with the XMPP Registrar [14].


Appendix A: Document Information

XMPP Standards Foundation
Standards Track
Last Updated
Approving Body
XMPP Council
Superseded By
Short Name
Source Control

This document in other formats: XML  PDF

Appendix B: Author Information

Peter Saint-Andre


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


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. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.

2. XEP-0174: Link-Local Messaging <https://xmpp.org/extensions/xep-0174.html>.

3. XEP-0247: Jingle XML Streams <https://xmpp.org/extensions/xep-0247.html>.

4. XEP-0065: SOCKS5 Bytestreams <https://xmpp.org/extensions/xep-0065.html>.

5. XEP-0047: In-Band Bytestreams <https://xmpp.org/extensions/xep-0047.html>.

6. RFC 6544: TCP Candidates with Interactive Connectivity Establishment (ICE) <http://tools.ietf.org/html/rfc6544>.

7. RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 <http://tools.ietf.org/html/rfc5246>.

8. RFC 4422: Simple Authentication and Security Layer (SASL) <http://tools.ietf.org/html/rfc4422>.

9. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

10. XEP-0027: Current Jabber OpenPGP Usage <https://xmpp.org/extensions/xep-0027.html>.

11. RFC 5081: Using OpenPGP Keys for Transport Layer Security (TLS) Authentication <http://tools.ietf.org/html/rfc5081>.

12. RFC 5054: Using the Secure Remote Password (SRP) Protocol for TLS Authentication <http://tools.ietf.org/html/rfc5054>.

13. 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/>.

14. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>.

Appendix H: Revision History

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

  1. Version 0.1.1 (2016-01-20)

    Updated missing 'ice-tcp' reference to RFC 6544.

    XEP Editor (mam)
  2. Version 0.1 (2008-06-18)

    Initial published version.

  3. Version 0.0.1 (2008-06-13)

    First draft, split off from XEP-0174.


Appendix I: Bib(La)TeX Entry

  title = {End-to-End XML Streams},
  author = {Saint-Andre, Peter},
  type = {XEP},
  number = {0246},
  version = {0.1.1},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0246.html},
  date = {2008-06-13/2016-01-20},