[hybi] WebSocket closing handshake
Fumitoshi Ukai (鵜飼文敏) <ukai@chromium.org> Tue, 18 May 2010 10:46 UTC
Return-Path: <ukai@google.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 483D23A692B for <hybi@core3.amsl.com>; Tue, 18 May 2010 03:46:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -103.076
X-Spam-Level:
X-Spam-Status: No, score=-103.076 tagged_above=-999 required=5 tests=[BAYES_50=0.001, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, MIME_8BIT_HEADER=0.3, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GIcn4EGTWoI4 for <hybi@core3.amsl.com>; Tue, 18 May 2010 03:46:24 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id EA8BE3A696C for <hybi@ietf.org>; Tue, 18 May 2010 03:46:20 -0700 (PDT)
Received: from hpaq6.eem.corp.google.com (hpaq6.eem.corp.google.com [172.25.149.6]) by smtp-out.google.com with ESMTP id o4IAkBZW026208 for <hybi@ietf.org>; Tue, 18 May 2010 03:46:11 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1274179572; bh=uxZMe0vk4abb4I0z4yZrh37raAk=; h=MIME-Version:Sender:From:Date:Message-ID:Subject:To:Content-Type; b=x7ml6Gc7YuLc7d2Nikhkw/qbYrFlmPEkQOnn6vxm4jJYU0sFDVaERx4JnKyjbv8Pw AldadDaFs+xwyQL+704ww==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:sender:from:date: x-google-sender-auth:message-id:subject:to:content-type:x-system-of-record; b=jC8sXNKeDORATM51hUGrZwCOQFWzay63ZvVKRZp1ri5pSvPVtoJCL5gYjCX1UoAlj W6un4yj+6+2Bc3d+8QQJQ==
Received: from qyk26 (qyk26.prod.google.com [10.241.83.154]) by hpaq6.eem.corp.google.com with ESMTP id o4IAjhRl024736 for <hybi@ietf.org>; Tue, 18 May 2010 03:46:10 -0700
Received: by qyk26 with SMTP id 26so3035714qyk.28 for <hybi@ietf.org>; Tue, 18 May 2010 03:46:09 -0700 (PDT)
Received: by 10.229.227.205 with SMTP id jb13mr1227451qcb.96.1274179569110; Tue, 18 May 2010 03:46:09 -0700 (PDT)
MIME-Version: 1.0
Sender: ukai@google.com
Received: by 10.229.78.197 with HTTP; Tue, 18 May 2010 03:45:49 -0700 (PDT)
From: "Fumitoshi Ukai (鵜飼文敏)" <ukai@chromium.org>
Date: Tue, 18 May 2010 19:45:49 +0900
X-Google-Sender-Auth: MzqNxrhDOKvlJX5FeUPf6KAHjho
Message-ID: <AANLkTilA1YkIQmByugOS2TYAgUylB6mx9N4M5OWufQJF@mail.gmail.com>
To: hybi@ietf.org
Content-Type: multipart/alternative; boundary="0016362850ba98d0910486dc0c57"
X-System-Of-Record: true
Subject: [hybi] WebSocket closing handshake
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 18 May 2010 10:46:25 -0000
Hi,
I've question about WebSocket closing handshake.
closing handshake is described as follows:
Once a WebSocket connection is established, the user agent must use
the following steps to *start the WebSocket closing handshake*.
These steps must be run asynchronously relative to whatever algorithm
invoked this one.
1. If the WebSocket closing handshake has started, then abort these
steps.
2. Send a 0xFF byte to the server.
3. Send a 0x00 byte to the server.
4. *The WebSocket closing handshake has started*.
5. Wait a user-agent-determined length of time, or until the
WebSocket connection is closed.
6. If the WebSocket connection is not already closed, then close the
WebSocket connection. (If this happens, then the closing
handshake doesn't finish.)
What means "Send a 0xXX byte to the server" in this context?
A) Put 0xXX byte in WebSocket message queue to the server. "Send 0xXX byte
to the server" finishes immediately after put in queue.
B) Put 0xXX byte in WebSocket message queue to the server, and make sure
the byte was actually sent to the TCP connection.
C) Send 0xXX byte to the server, ignoring WebSocket message queue.
I think option C is not reasonable. The server would fail to parse
WebSocket frame, if 0xFF 0x00 might be sent in the middle of large WebSocket
frame.
If this means A, then can we "close the WebSocket connection" (close the TCP
connection) without sending bytes in WebSocket message queue to the server?
It would happen
0xFF 0x00 frame is received
If the WebSocket closing handshake has not yet started, then start the
WebSocket closing handshake.
put 0xFF 0x00 to the queue.
WebSocket closing handshake has started
Wait until either the WebSocket closing handshake has started or the
WebSocket connection is closed. Yes, WebSocket closing handshake has
started.
If the WebSocket connection is not already closed, then close the
WebSocket connection.
0xFF 0x00 may be still in queue, and try to close the TCP
connection.
If this means B, will we send 0xFF 0x00 several time?
For example,
ws.close() is called in OPEN state, start the WebSocket closing
handshake.
The WebSocket closing handshake has not yet started
Put 0xFF 0x00 to the queue and wait for these byte sent to the TCP
connection.
while waitng, receive 0xFF 0x00 frame, run the following substeps
- If the WebSocket closing has not yet started, yes, it has not yet
finished sending 0xFF 0x00 bytes, so start the WebSocket closing handshake
again (put 0xFF 0x00 to the queue)
Or any other interpretation?
Thanks,
Fumitoshi Ukai
- [hybi] WebSocket closing handshake Fumitoshi Ukai (鵜飼文敏)
- Re: [hybi] WebSocket closing handshake Ian Hickson