draft-ietf-xmpp-websocket-03.txt   draft-ietf-xmpp-websocket-04.txt 
XMPP Working Group L. Stout, Ed. XMPP Working Group L. Stout, Ed.
Internet-Draft &yet Internet-Draft &yet
Intended status: Standards Track J. Moffitt Intended status: Standards Track J. Moffitt
Expires: October 21, 2014 Mozilla Expires: October 22, 2014 Mozilla
E. Cestari E. Cestari
cstar industries cstar industries
April 19, 2014 April 20, 2014
An XMPP Sub-protocol for WebSocket An XMPP Sub-protocol for WebSocket
draft-ietf-xmpp-websocket-03 draft-ietf-xmpp-websocket-04
Abstract Abstract
This document defines a binding for the XMPP protocol over a This document defines a binding for the XMPP protocol over a
WebSocket transport layer. A WebSocket binding for XMPP provides WebSocket transport layer. A WebSocket binding for XMPP provides
higher performance than the current HTTP binding for XMPP. higher performance than the current HTTP binding for XMPP.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
skipping to change at page 1, line 35 skipping to change at page 1, line 35
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on October 21, 2014. This Internet-Draft will expire on October 22, 2014.
Copyright Notice Copyright Notice
Copyright (c) 2014 IETF Trust and the persons identified as the Copyright (c) 2014 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 19 skipping to change at page 2, line 19
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. XMPP Sub-Protocol . . . . . . . . . . . . . . . . . . . . . . 3 3. XMPP Sub-Protocol . . . . . . . . . . . . . . . . . . . . . . 3
3.1. Handshake . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1. Handshake . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2. WebSocket Messages . . . . . . . . . . . . . . . . . . . 4 3.2. WebSocket Messages . . . . . . . . . . . . . . . . . . . 4
3.3. XMPP Framing . . . . . . . . . . . . . . . . . . . . . . 4 3.3. XMPP Framing . . . . . . . . . . . . . . . . . . . . . . 4
3.3.1. Framed XML Stream . . . . . . . . . . . . . . . . . . 4 3.3.1. Framed XML Stream . . . . . . . . . . . . . . . . . . 4
3.3.2. Framed Stream Namespace . . . . . . . . . . . . . . . 5 3.3.2. Framed Stream Namespace . . . . . . . . . . . . . . . 5
3.3.3. Stream Frames . . . . . . . . . . . . . . . . . . . . 5 3.3.3. Stream Frames . . . . . . . . . . . . . . . . . . . . 5
3.4. Stream Initiation . . . . . . . . . . . . . . . . . . . . 6 3.4. Stream Initiation . . . . . . . . . . . . . . . . . . . . 6
3.5. Stream Errors . . . . . . . . . . . . . . . . . . . . . . 6 3.5. Stream Errors . . . . . . . . . . . . . . . . . . . . . . 7
3.6. Closing the Connection . . . . . . . . . . . . . . . . . 6 3.6. Closing the Connection . . . . . . . . . . . . . . . . . 7
3.6.1. see-other-uri . . . . . . . . . . . . . . . . . . . . 7 3.6.1. see-other-uri . . . . . . . . . . . . . . . . . . . . 8
3.7. Stream Restarts . . . . . . . . . . . . . . . . . . . . . 8 3.7. Stream Restarts . . . . . . . . . . . . . . . . . . . . . 8
3.8. Pings and Keepalives . . . . . . . . . . . . . . . . . . 8 3.8. Pings and Keepalives . . . . . . . . . . . . . . . . . . 8
3.9. Use of TLS . . . . . . . . . . . . . . . . . . . . . . . 8 3.9. Use of TLS . . . . . . . . . . . . . . . . . . . . . . . 9
3.10. Stream Management . . . . . . . . . . . . . . . . . . . . 9 3.10. Stream Management . . . . . . . . . . . . . . . . . . . . 9
4. Discovering the WebSocket Connection Method . . . . . . . . . 9 4. Discovering the WebSocket Connection Method . . . . . . . . . 9
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10
5.1. WebSocket Subprotocol Name . . . . . . . . . . . . . . . 9 5.1. WebSocket Subprotocol Name . . . . . . . . . . . . . . . 10
5.2. URN Sub-Namespace . . . . . . . . . . . . . . . . . . . . 10 5.2. URN Sub-Namespace . . . . . . . . . . . . . . . . . . . . 10
6. Security Considerations . . . . . . . . . . . . . . . . . . . 10 6. Security Considerations . . . . . . . . . . . . . . . . . . . 11
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 11
7.1. Normative References . . . . . . . . . . . . . . . . . . 11 7.1. Normative References . . . . . . . . . . . . . . . . . . 11
7.2. Informative References . . . . . . . . . . . . . . . . . 11 7.2. Informative References . . . . . . . . . . . . . . . . . 11
Appendix A. XML Schema . . . . . . . . . . . . . . . . . . . . . 12 Appendix A. XML Schema . . . . . . . . . . . . . . . . . . . . . 12
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 13 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 14
1. Introduction 1. Introduction
Applications using the Extensible Messaging and Presence Protocol Applications using the Extensible Messaging and Presence Protocol
(XMPP) (see [RFC6120] and [RFC6121]) on the Web currently make use of (XMPP) (see [RFC6120] and [RFC6121]) on the Web currently make use of
BOSH (see [XEP-0124] and [XEP-0206]), an XMPP binding to HTTP. BOSH BOSH (see [XEP-0124] and [XEP-0206]), an XMPP binding to HTTP. BOSH
is based on the HTTP long polling technique, and it suffers from high is based on the HTTP long polling technique, and it suffers from high
transport overhead compared to XMPP's native binding to TCP. In transport overhead compared to XMPP's native binding to TCP. In
addition, there are a number of other known issues with long polling addition, there are a number of other known issues with long polling
[RFC6202], which have an impact on BOSH-based systems. [RFC6202], which have an impact on BOSH-based systems.
skipping to change at page 4, line 28 skipping to change at page 4, line 28
... ...
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
Sec-WebSocket-Protocol: xmpp Sec-WebSocket-Protocol: xmpp
[WebSocket connection established] [WebSocket connection established]
C: <open xmlns="urn:ietf:params:xml:ns:xmpp-framing" C: <open xmlns="urn:ietf:params:xml:ns:xmpp-framing"
to="example.com" to="example.com"
version="1.0" /> version="1.0" />
S: <open xmlns="urn:ietf:params:xml:ns:xmpp-framing"
from="example.com"
id="++TR84Sm6A3hnt3Q065SnAbbk3Y="
xml:lang="en"
version="1.0" />
3.2. WebSocket Messages 3.2. WebSocket Messages
Data frame messages in the XMPP sub-protocol MUST be of the text type Data frame messages in the XMPP sub-protocol MUST be of the text type
and contain UTF-8 encoded data. and contain UTF-8 encoded data.
3.3. XMPP Framing 3.3. XMPP Framing
The WebSocket XMPP sub-protocol deviates from the standard method of The WebSocket XMPP sub-protocol deviates from the standard method of
constructing and using XML streams as defined in [RFC6120] by constructing and using XML streams as defined in [RFC6120] by
adopting the message framing provided by WebSocket to delineate the adopting the message framing provided by WebSocket to delineate the
stream open and close headers, stanzas, and other top-level stream stream open and close headers, stanzas, and other top-level stream
elements. elements.
3.3.1. Framed XML Stream 3.3.1. Framed XML Stream
The start of a framed XML stream is marked by the use of an opening The start of a framed XML stream is marked by the use of an opening
"stream header" which is an <open/> element with the appropriate "stream header" which is an <open/> element with the appropriate
attributes and namespace declarations (see Section 3.3.2). The attributes and namespace declarations (see Section 3.3.2). The
attributes of the <open/> element are the same as those of the attributes of the <open/> element are the same as those of the
<stream/> element defined in [RFC6120], and with the same semantics. <stream/> element defined defined for the 'http://etherx.jabber.org/
streams' namespace in [RFC6120] and with the same semantics and
restrictions.
The end of a framed XML stream is denoted by the closing "stream The end of a framed XML stream is denoted by the closing "stream
header" which is a <close/> element with its associated attributes header" which is a <close/> element with its associated attributes
and namespace declarations (see Section 3.3.2). and namespace declarations (see Section 3.3.2).
The introduction of the <open/> and <close/> elements is motivated by The introduction of the <open/> and <close/> elements is motivated by
the parsable XML document framing restriction in Section 3.3.3. As a the parsable XML document framing restriction in Section 3.3.3. As a
consequence, note that a framed XML stream does not provided a consequence, note that a framed XML stream does not provided a
wrapping <stream:stream/> element encompassing the entirety of the wrapping <stream:stream/> element encompassing the entirety of the
XML stream, as in [RFC6120]. XML stream, as in [RFC6120].
skipping to change at page 5, line 41 skipping to change at page 6, line 10
Every XMPP stanza or other XML element (including the stream open and Every XMPP stanza or other XML element (including the stream open and
close headers) sent directly over the XML stream MUST be sent in its close headers) sent directly over the XML stream MUST be sent in its
own frame. own frame.
Examples of WebSocket messages that contain independently parsable Examples of WebSocket messages that contain independently parsable
XML documents (note that for stream features and errors, there is no XML documents (note that for stream features and errors, there is no
parent context element providing the "stream" namespace prefix as in parent context element providing the "stream" namespace prefix as in
[RFC6120], and thus the stream namespace MUST be declared): [RFC6120], and thus the stream namespace MUST be declared):
-- WS Message boundary -- -- WS Message boundary --
<stream:features xmlns:stream="http://etherx.jabber.org/streams"> <stream:features xmlns:stream="http://etherx.jabber.org/streams">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/> <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
</stream:features> </stream:features>
-- WS Message boundary -- -- WS Message boundary --
<error xmlns="http://etherx.jabber.org/streams"> <error xmlns="http://etherx.jabber.org/streams">
<host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/> <host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</error> </error>
-- WS Message boundary -- -- WS Message boundary --
<message xmlns="jabber:client" xml:lang="en"> <message xmlns="jabber:client" xml:lang="en">
<body>Every WebSocket message is parsable by itself.</body> <body>Every WebSocket message is parsable by itself.</body>
</message> </message>
3.4. Stream Initiation 3.4. Stream Initiation
The first message sent by the initiating entity after the WebSocket The first message sent after the WebSocket opening handshake MUST be
opening handshake is complete MUST be an <open/> element qualified by from the initiating entity, and MUST be an <open/> element qualified
the "urn:ietf:params:xml:ns:xmpp-framing" namespace. The 'from', by the "urn:ietf:params:xml:ns:xmpp-framing" namespace and with the
'id', 'to', and 'version' attributes of this element mirror those of same attributes mandated for the <stream> opening tag as described in
the XMPP opening stream tag as defined for the Section 4.7 of [RFC6120].
'http://etherx.jabber.org/streams' namespace in XMPP [RFC6120].
The receiving entity MUST respond with an <open /> element, or a The receiving entity MUST respond with either an <open /> element
<close /> element (see Section 3.6.1). (whose attributes match those described in Section 4.7 of [RFC6120])
or a <close /> element (see Section 3.6.1).
An example of a successful stream initiation exchange:
C: <open xmlns="urn:ietf:params:xml:ns:xmpp-framing"
to="example.com"
version="1.0" />
S: <open xmlns="urn:ietf:params:xml:ns:xmpp-framing"
from="example.com"
id="++TR84Sm6A3hnt3Q065SnAbbk3Y="
xml:lang="en"
version="1.0" />
Clients MUST NOT multiplex XMPP streams over the same WebSocket. Clients MUST NOT multiplex XMPP streams over the same WebSocket.
3.5. Stream Errors 3.5. Stream Errors
Stream level errors in XMPP are terminal. Should such an error Stream level errors in XMPP are terminal. Should such an error
occur, the server MUST send the stream error as a complete element in occur, the server MUST send the stream error as a complete element in
a message to the client. a message to the client.
If the error occurs during the opening of a stream, the server MUST If the error occurs during the opening of a stream, the server MUST
 End of changes. 14 change blocks. 
33 lines changed or deleted 53 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/