The WebSocket Protocol
draft-ietf-hybi-thewebsocketprotocol-17

The information below is for an old version of the document that is already published as an RFC
Document Type RFC Internet-Draft (hybi WG)
Authors Alexey Melnikov  , Ian Fette 
Last updated 2020-01-21 (latest revision 2011-09-30)
Replaces draft-hixie-thewebsocketprotocol
Stream Internet Engineering Task Force (IETF)
Formats pdf htmlized (tools) htmlized bibtex
Reviews
Stream WG state WG Document
Document shepherd Salvatore Loreto
Shepherd write-up Show (last changed 2011-09-01)
IESG IESG state RFC 6455 (Proposed Standard)
Consensus Boilerplate Unknown
Telechat date
Responsible AD Peter Saint-Andre
Send notices to (None)
HyBi Working Group                                              I. Fette
Internet-Draft                                              Google, Inc.
Intended status: Standards Track                             A. Melnikov
Expires: April 2, 2012                                         Isode Ltd
                                                      September 30, 2011

                         The WebSocket protocol
                draft-ietf-hybi-thewebsocketprotocol-17

Abstract

   The WebSocket protocol enables two-way communication between a client
   running untrusted code running in a controlled environment to a
   remote host that has opted-in to communications from that code.  The
   security model used for this is the Origin-based security model
   commonly used by Web browsers.  The protocol consists of an opening
   handshake followed by basic message framing, layered over TCP.  The
   goal of this technology is to provide a mechanism for browser-based
   applications that need two-way communication with servers that does
   not rely on opening multiple HTTP connections (e.g. using
   XMLHttpRequest or <iframe>s and long polling).

   Please send feedback to the hybi@ietf.org mailing list.

Status of this Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on April 2, 2012.

Copyright Notice

   Copyright (c) 2011 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal

Fette & Melnikov          Expires April 2, 2012                 [Page 1]
Internet-Draft           The WebSocket protocol           September 2011

   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  5
     1.1.  Background . . . . . . . . . . . . . . . . . . . . . . . .  5
     1.2.  Protocol Overview  . . . . . . . . . . . . . . . . . . . .  6
     1.3.  Opening Handshake  . . . . . . . . . . . . . . . . . . . .  7
     1.4.  Closing Handshake  . . . . . . . . . . . . . . . . . . . . 10
     1.5.  Design Philosophy  . . . . . . . . . . . . . . . . . . . . 10
     1.6.  Security Model . . . . . . . . . . . . . . . . . . . . . . 11
     1.7.  Relationship to TCP and HTTP . . . . . . . . . . . . . . . 12
     1.8.  Establishing a Connection  . . . . . . . . . . . . . . . . 12
     1.9.  Subprotocols Using the WebSocket protocol  . . . . . . . . 12
   2.  Conformance Requirements . . . . . . . . . . . . . . . . . . . 14
     2.1.  Terminology and other conventions  . . . . . . . . . . . . 14
   3.  WebSocket URIs . . . . . . . . . . . . . . . . . . . . . . . . 16
   4.  Opening Handshake  . . . . . . . . . . . . . . . . . . . . . . 17
     4.1.  Client Requirements  . . . . . . . . . . . . . . . . . . . 17
     4.2.  Server-side Requirements . . . . . . . . . . . . . . . . . 22
       4.2.1.  Reading the Client's Opening Handshake . . . . . . . . 23
       4.2.2.  Sending the Server's Opening Handshake . . . . . . . . 24
     4.3.  Collected ABNF for new header fields used in handshake . . 27
     4.4.  Supporting multiple versions of WebSocket protocol . . . . 28
   5.  Data Framing . . . . . . . . . . . . . . . . . . . . . . . . . 30
     5.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . . 30
     5.2.  Base Framing Protocol  . . . . . . . . . . . . . . . . . . 30
     5.3.  Client-to-Server Masking . . . . . . . . . . . . . . . . . 35
     5.4.  Fragmentation  . . . . . . . . . . . . . . . . . . . . . . 36
     5.5.  Control Frames . . . . . . . . . . . . . . . . . . . . . . 38
       5.5.1.  Close  . . . . . . . . . . . . . . . . . . . . . . . . 38
       5.5.2.  Ping . . . . . . . . . . . . . . . . . . . . . . . . . 39
       5.5.3.  Pong . . . . . . . . . . . . . . . . . . . . . . . . . 39
     5.6.  Data Frames  . . . . . . . . . . . . . . . . . . . . . . . 40
     5.7.  Examples . . . . . . . . . . . . . . . . . . . . . . . . . 40
Show full document text