JEP-0138: Stream Compression

This JEP defines a mechanism for compressing XML streams.

NOTICE: This JEP is currently within Last Call or under consideration by the Jabber Council for advancement to the next stage in the JSF standards process. For further details, visit <>.

JEP Information

Status: Proposed
Type: Standards Track
Number: 0138
Version: 0.3
Last Updated: 2005-03-28
JIG: Standards JIG
Approving Body: Jabber Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: compress

Author Information

Joe Hildebrand


Peter Saint-Andre


Legal Notice

This Jabber Enhancement Proposal is copyright 1999 - 2005 by the Jabber Software Foundation (JSF) and is in full conformance with the JSF's Intellectual Property Rights Policy <>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at <>).

Discussion Venue

The preferred venue for discussion of this document is the Standards-JIG discussion list: <>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the Jabber Software Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocols defined in this JEP have been developed outside the Internet Standards Process and are to be understood as extensions to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Table of Contents

1. Introduction
2. Use Case
3. Business Rules
4. Implementation Notes
4.1. zlib
5. Security Considerations
6. IANA Considerations
7. Jabber Registrar Considerations
7.1. Stream Features
7.2. Protocol Namespaces
7.3. Compression Methods Registry
7.3.1. Process
7.3.2. Initial Registration
8. XML Schemas
8.1. Stream Feature
8.2. Protocol Namespace
Revision History

1. Introduction

XMPP Core [1] specifies the use of Transport Layer Security (see RFC 2246 [2]) for encryption of XML streams, and TLS includes the ability to compress encrypted traffic (see RFC 3749 [3]). However, not all devices are able to implement TLS, and traffic compression may be desirable for communication by such devices. This JEP defines a mechanism for compressing XML streams outside the context of TLS.

Such compression could be performed using any number of compression methods. While the only method required by this JEP is ZLIB (as specified in RFC 1950 [4]), other methods MAY be defined in future JEPs or by registration as described in the Compression Methods Registry section of this document.

2. Use Case

The protocol flow is as follows:

Example 1. Server Offers Stream Compression Feature

  <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
  <compression xmlns=''>

Example 2. Client Requests Stream Compression

<compress xmlns=''>

Example 3. Server Acknowledges Stream Compression

<compressed xmlns=''/>

Both entities MUST now consider the previous stream to be null and void, just as with TLS negotiation and SASL negotiation (as specified in XMPP Core). Therefore the client MUST initiate a new stream to the server:

Example 4. Client Initiates New Stream


3. Business Rules

The following business rules apply:

4. Implementation Notes

4.1 zlib

When using zlib for compression, the sending application SHOULD complete a partial flush of zlib when its current send is complete. Note that this statement is deliberately somewhat vague: the sending application may end up performing this partial flush after sending every XML stanza, but on the other hand may perform the partial flush only after sending a group of stanzas that have been queued up for delivery. When to flush the state of the compression application is up to the sending application.

5. Security Considerations

Stream encryption via TLS (as defined in XMPP Core) and stream compression (as defined herein) are not mutually exclusive, but stream encryption via TLS MUST be negotiated before negotiation of stream compression in order to secure the stream.

6. IANA Considerations

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

7. Jabber Registrar Considerations

7.1 Stream Features

The Jabber Registrar [6] shall include '' in its registry of stream features.

7.2 Protocol Namespaces

The Jabber Registrar shall include '' in its registry of protocol namespaces.

7.3 Compression Methods Registry

The Jabber Registrar shall maintain a registry of compression methods.

7.3.1 Process

In order to submit new values to this registry, the registrant must define an XML fragment of the following form and either include it in the relevant Jabber Enhancement Proposal or send it to the email address <>:

  <name>the XML character data of the method element</name>
  <desc>a natural-language description of the compression method</desc>
  <doc>the document that specifies or registers the compression method</doc>

The registrant may register more than one compression method at a time, each contained in a separate <method/> element.

7.3.2 Initial Registration

  <desc>the ZLIB compression method as specified in RFC 1950</desc>

8. XML Schemas

8.1 Stream Feature

<?xml version='1.0' encoding='UTF-8'?>


  <xs:element name='compression'/>
        <xs:element name='method' type='xs:NCName' minOccurs='0' maxOccurs='unbounded'/>


8.2 Protocol Namespace

<?xml version='1.0' encoding='UTF-8'?>


  <xs:element name='compress' type='empty'/>
  <xs:element name='compressed' type='empty'/>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>



1. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <>.

2. RFC 2246: The TLS Protocol Version 1.0 <>.

3. RFC 3749: Transport Layer Security Protocol Compression Methods <>.

4. RFC 1950: ZLIB Compressed Data Format Specification version 3.3 <>.

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

6. The Jabber Registrar maintains a list of reserved Jabber protocol namespaces as well as registries of parameters used in the context of protocols approved by the Jabber Software Foundation. For further information, see <>.

Revision History

Version 0.3 (2005-03-28)

Specified compression methods registry. (psa)

Version 0.2 (2004-09-28)

Fixed TLS text per list discussion. (psa)

Version 0.1 (2004-07-16)

Initial version. (jjh/psa)