Re: [hybi] WebSocket closing handshake

Ian Hickson <ian@hixie.ch> Fri, 06 August 2010 01:09 UTC

Return-Path: <ian@hixie.ch>
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 6CC583A689F for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 18:09:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.377
X-Spam-Level:
X-Spam-Status: No, score=-2.377 tagged_above=-999 required=5 tests=[AWL=-0.078, BAYES_00=-2.599, MIME_8BIT_HEADER=0.3]
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 FMhtr6zIYOA1 for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 18:09:47 -0700 (PDT)
Received: from hapkido.dreamhost.com (hapkido.dreamhost.com [66.33.216.122]) by core3.amsl.com (Postfix) with ESMTP id 5CAE43A6782 for <hybi@ietf.org>; Thu, 5 Aug 2010 18:09:47 -0700 (PDT)
Received: from homiemail-a54.g.dreamhost.com (caibbdcaaaaf.dreamhost.com [208.113.200.5]) by hapkido.dreamhost.com (Postfix) with ESMTP id 5090417A2EE for <hybi@ietf.org>; Thu, 5 Aug 2010 18:10:18 -0700 (PDT)
Received: from homiemail-a54.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a54.g.dreamhost.com (Postfix) with ESMTP id B3E423A406D; Thu, 5 Aug 2010 18:09:57 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=hixie.ch; h=date:from:to:cc :subject:in-reply-to:message-id:references:mime-version: content-type; q=dns; s=hixie.ch; b=B+P/5kHZNdECdExz2PLVTEWk0NPX6 XFNfd3UGmAN8dmHYP16eM6fElU0NEAonWm21RjsVq0dfC43YE94hviuOOTWgWjMh dZxDN3lq/dzpnADtxtXil1Pi3qqo1qfvZ/TVqrVOl5gVedjVqdX52d0oCbLRS/n1 dneMuDoOvxPFmE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=hixie.ch; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version: content-type; s=hixie.ch; bh=xYqgr00tDQqHARlN3tat6Aq11Aw=; b=0SS ESmc8CGO/+ZOgaCOfAOGTsPcupl6v49123RL1NWTcGnVH2ihUEp82y1zBPwncLO6 vZpvOL4NSZ/neMOTp+kbWURelkP+FLdTkfLoGefJcZ+jlJ+uD3dgbW/tZrghkJiS J0353SsDVTSAd5xjavrlE1W/OruJAo3X5e7Ll5Ao=
Received: from ps20323.dreamhostps.com (ps20323.dreamhost.com [69.163.222.251]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: internal@index.hixie.ch) by homiemail-a54.g.dreamhost.com (Postfix) with ESMTPSA id 96BCA3A406B; Thu, 5 Aug 2010 18:09:57 -0700 (PDT)
Date: Fri, 06 Aug 2010 01:09:57 +0000
From: Ian Hickson <ian@hixie.ch>
To: "Fumitoshi Ukai (鵜飼文敏)" <ukai@chromium.org>
In-Reply-To: <AANLkTilA1YkIQmByugOS2TYAgUylB6mx9N4M5OWufQJF@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.1008060104140.7470@ps20323.dreamhostps.com>
References: <AANLkTilA1YkIQmByugOS2TYAgUylB6mx9N4M5OWufQJF@mail.gmail.com>
Content-Language: en-GB-hixie
Content-Style-Type: text/css
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="-1555694626-935611642-1281056997=:7470"
Cc: hybi@ietf.org
Subject: Re: [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: Fri, 06 Aug 2010 01:09:48 -0000

On Tue, 18 May 2010, Fumitoshi Ukai (éµ~\飼æ~V~Gæ~U~O) wrote:
>
> I've question about WebSocket closing handshake. closing handshake is 
> described as follows: [...]
> 
> 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.

When an implementation is required to send data as part of the WebSocket 
protocol, the implementation may delay the actual transmission 
arbitrarily, e.g. buffering data so as to send fewer IP packets.

I think this means A. I'm not sure what a "WebSocket message queue" is, 
though. I assume you mean the outgoing network buffer(s).


> 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?

You can only "close the WebSocket connection" where the spec says you can, 
but yes, if the spec says you can "close the WebSocket connection" at a 
point where not all buffered bytes have been sent, then the bytes are 
lost. This generally only happens after a timeout or an error.


(Note that the closing handshake changed slightly in the recent changes to 
the framing. The semantics are the same but the bytes are different.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'