Re: [hybi] Straw poll: Do you miss interjectable WebSocket level control frame? (was: Re: Discontinuation of mux ...)

Zhong Yu <zhong.j.yu@gmail.com> Wed, 26 February 2014 00:54 UTC

Return-Path: <zhong.j.yu@gmail.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9D5A71A0347 for <hybi@ietfa.amsl.com>; Tue, 25 Feb 2014 16:54:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.6
X-Spam-Level:
X-Spam-Status: No, score=0.6 tagged_above=-999 required=5 tests=[BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, J_CHICKENPOX_26=0.6, J_CHICKENPOX_52=0.6, SPF_PASS=-0.001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ieX6xrY3DxaY for <hybi@ietfa.amsl.com>; Tue, 25 Feb 2014 16:54:17 -0800 (PST)
Received: from mail-oa0-x22a.google.com (mail-oa0-x22a.google.com [IPv6:2607:f8b0:4003:c02::22a]) by ietfa.amsl.com (Postfix) with ESMTP id 5C4FC1A020A for <hybi@ietf.org>; Tue, 25 Feb 2014 16:54:17 -0800 (PST)
Received: by mail-oa0-f42.google.com with SMTP id j17so107990oag.29 for <hybi@ietf.org>; Tue, 25 Feb 2014 16:54:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YLzhFm/xu7N3OF70v4O2+Qv4sXxmYVoyWk3v4Dusxr4=; b=ozpDJat38JQqzHpbQAPd6+mY2c5xKpdkVg48k1OYQbIMCAIQ70NuDGCgHAb8BbvAEU oslBPjkLa6u+KwHs4d/OgjNbLplh37J6sUNN8tQEDKKGpsubxiyHJNPnZW+Es1CkdpCy 3UrRvdErOT70w73lMEWSNYYJMkxGUtFPUPZrfAdrWuDgH3imlVt2WdZe1pdLxaIO+U+1 NFZiIW+BfRjBbe6U55Jgi0l1kkxRK87mp6LmK9exw4SAifnwH2FwEBFwUPJRdoWBghJI AXQFTWDDyWqPFpfNSvZNqmduk7nlGsHA4D/U3BVzVma5tsRM6BvC0z7O60NGNABKHSUz +36w==
MIME-Version: 1.0
X-Received: by 10.60.98.73 with SMTP id eg9mr49145oeb.81.1393376056283; Tue, 25 Feb 2014 16:54:16 -0800 (PST)
Received: by 10.76.106.162 with HTTP; Tue, 25 Feb 2014 16:54:16 -0800 (PST)
In-Reply-To: <CAH9hSJbSfQ2Abp6oLifi0dx4TZENzm2QRn8zMQfAv=vw+H12sw@mail.gmail.com>
References: <CAH9hSJbjQNKnZTJmBFtU8MgmnRTYjPopC4oP_78bWUGap-9CvA@mail.gmail.com> <CAH9hSJbBmvNPBSSAk-khdWXgWw0GTt0FG3KsdzYeJcfiAPDk0A@mail.gmail.com> <CAHixhFq=wfmYH8-ij_WtsQLN=NUTJwRQ=k8jCPepQDM8V8ZZYA@mail.gmail.com> <CABihn6EN7V6XEwf6NWn78orxvr3XjGHxROJC4JjQ6RYYKEeCug@mail.gmail.com> <CACuKZqHNoR5GQmWyzbXAszZCOT2P4pjSmT3SF6ZG3X7hTY=1xw@mail.gmail.com> <CABihn6GC4VM2AHza-F7ML=FfHLZu7FNqx+BhbuVsfJLWk0P92w@mail.gmail.com> <CAH9hSJbSfQ2Abp6oLifi0dx4TZENzm2QRn8zMQfAv=vw+H12sw@mail.gmail.com>
Date: Tue, 25 Feb 2014 18:54:16 -0600
Message-ID: <CACuKZqGhBN5SnuUEyRccaqQiBP1tE8r=K+9ioFGikG60a9bFyQ@mail.gmail.com>
From: Zhong Yu <zhong.j.yu@gmail.com>
To: Takeshi Yoshino <tyoshino@google.com>
Content-Type: text/plain; charset="ISO-8859-1"
Archived-At: http://mailarchive.ietf.org/arch/msg/hybi/vdm2DXn8opPXkivasBXwrbJJex4
Cc: "hybi@ietf.org" <hybi@ietf.org>, Peter Thorson <webmaster@zaphoyd.com>
Subject: Re: [hybi] Straw poll: Do you miss interjectable WebSocket level control frame? (was: Re: Discontinuation of mux ...)
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Wed, 26 Feb 2014 00:54:19 -0000

To be certain that data is delivered, app needs to perform lingering
close by itself, by polling bufferedAmount, and only call close()
after it reaches 0.

This is strange, due to the flaw that send() is an async method but
without a way to registered a callback.

Zhong Yu


On Tue, Feb 25, 2014 at 4:05 PM, Takeshi Yoshino <tyoshino@google.com> wrote:
> On Tue, Feb 25, 2014 at 5:27 PM, Yutaka Hirano <yhirano@chromium.org> wrote:
>>>
>>> Shouldn't ws.close() allow queued messages to be flushed before the
>>> actual closing?
>>
>> It is allowed to wait until the endpoint finishes sending the message.
>> Is it the desired behavior? I thought it is undesired, but I'm not
>> confident now.
>
>
> I think it's underspecified. In the WHATWG WebSocket API spec, close() is
> required to "start the WebSocket closing handshake". RFC 6455 neither says
> the algorithm may terminate ongoing "Send a WebSocket Message" algorithm nor
> says it may not.
>
> ----
>
> Even if we allow close to terminate ongoing send, since the sender requests
> the termination explicitly and the peer replies to the close with a close
> frame after understanding the ongoing send is cancelled, it's fine to call
> it as clean close, I think.
>
> There's no way in the WebSocket API to tell that the message it is receiving
> has been cancelled to the script, but I don't think it's problematic. The
> message sending was clearly cancelled. Both side knows that. The receiver
> just won't deliver the cancelled message.
>
> ----
>
> But I think there're also needs for graceful close, i.e. to send a message
> and do closing handshake after finishing the send. If there's only method
> that terminates ongoing send, the user is required to do app level
> acknowledgement before calling the method.
>
> My gut feeling is that such a cancellation should be provides as a separate
> method and close() should work as a graceful close.
>
> This needs more discussion, but I believe WebSocket users are already used
> to graceful behavior.
>
>>
>> On Tue, Feb 25, 2014 at 2:40 PM, Zhong Yu <zhong.j.yu@gmail.com> wrote:
>>>
>>> On Mon, Feb 24, 2014 at 10:58 PM, Yutaka Hirano <yhirano@chromium.org>
>>> wrote:
>>> >> * Close: Can be used to perform a "clean" close in the middle of
>>> >> sending a
>>> >> message. However, I cannot think of any applications that would
>>> >> consider a
>>> >> situation in which a in-transit message was aborted to close the
>>> >> connection
>>> >> to be a "clean close" scenario.
>>> >
>>> > An endpoint should be able to cancel the ongoing transmission, i.e. The
>>> > close call should abort transferring very_very_long_message in the
>>> > following
>>> > code.
>>> >
>>> >
>>> > ws = new WebSocket(...);
>>> > ws.onopen = function() {
>>> >   ws.send(very_very_long_message);
>>> >   ws.close();
>>> > };
>>>
>>> Shouldn't ws.close() allow queued messages to be flushed before the
>>> actual closing?
>
>