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

Takeshi Yoshino <tyoshino@google.com> Wed, 26 February 2014 01:38 UTC

Return-Path: <tyoshino@google.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 A31FA1A0834 for <hybi@ietfa.amsl.com>; Tue, 25 Feb 2014 17:38:10 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.675
X-Spam-Level:
X-Spam-Status: No, score=0.675 tagged_above=-999 required=5 tests=[BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, J_CHICKENPOX_26=0.6, J_CHICKENPOX_52=0.6, RP_MATCHES_RCVD=-0.547, 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 7J4dRVq7dKkT for <hybi@ietfa.amsl.com>; Tue, 25 Feb 2014 17:38:08 -0800 (PST)
Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) by ietfa.amsl.com (Postfix) with ESMTP id 21D7C1A0313 for <hybi@ietf.org>; Tue, 25 Feb 2014 17:38:07 -0800 (PST)
Received: by mail-wi0-f171.google.com with SMTP id cc10so5292474wib.10 for <hybi@ietf.org>; Tue, 25 Feb 2014 17:38:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=/CJTx7dLmpyofTE9UuF5mV8q3NNAIN/g/h2HBqqrxQ0=; b=Qdfq8FPen6za49v88uP/ezBVZ27HiydxcdtNf1HPQgm4tvx7JE4RIX+zWf0nYcpMI+ RN8cDOcRlJ6/fm8TUscwObuZJvPw6TBUEVgCAsJhsU02vyvzSvrNeP1lFuGMgUL5Wk4Y QwxbugdfXjP4luGeostqDU8hwPxQGF1lwbnLFYJ7JP8dGzXnVz5YJPxAA58bJfYOn225 veTpEjnJykhj3XdAzGVfNjIhbTkXC4tTT0y08+9QJQqYAoQHlw+IcUrag5As0o7UKcA4 ObIIEjXDoo+nWmYeU+DE+Y6S+iq2IpdA4Gp3hYiV9c//af66ZewQSQmvbnJ7Ly1DwyQG qUSA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=/CJTx7dLmpyofTE9UuF5mV8q3NNAIN/g/h2HBqqrxQ0=; b=NTp2hl8sSMulVTukMBHhg0nZuqS4kov15WCTesPzS1lABZMleKOANU9wmq/5BBYadB Y8wqLcgB8Qs+2KWqnWMYbjgsn2QZ2pnHQP0dVtbtlrnOIsqwaVViwW4Q6QbZZgfwkuLB hLm1Qh347X/rFh0u2zxIt6wXxzK7tv3ZoH7M90RW/GNEiAWszJPVJJo3Q9qCoPfZPLl7 oOdk/DMR9X4xd+4bnq07poYhRmg+XZyGdGCwxIN47/xdlYHTi1PW2kWUBipBtGmpPUQ8 tnyL11P4bTCPiy+E78PnNaScM+raLJRgsPiYgvsgnRtW+rirH2LFRPzauhi2W15S30kt 0ATQ==
X-Gm-Message-State: ALoCoQkvlANCcUw6QPtTsdYJflu63dZ769da5gjG/z+faBVkiJ9dFxG0ntqG47llqJ8n+SMSvs/QmQHTIiEwfmR0xfOJcr/GBgIDx/z668bVeGbYmIwTjwwtjyZOG+hYYEk2CXgti0Ozqkim9npP+4jsrydgUXG6kbKrO5OMNINS73x+5hEdM1EJbhteRUfaAChQHsPQ976S
X-Received: by 10.180.221.68 with SMTP id qc4mr5557400wic.30.1393378686553; Tue, 25 Feb 2014 17:38:06 -0800 (PST)
MIME-Version: 1.0
Received: by 10.194.8.231 with HTTP; Tue, 25 Feb 2014 17:37:46 -0800 (PST)
In-Reply-To: <CACuKZqGhBN5SnuUEyRccaqQiBP1tE8r=K+9ioFGikG60a9bFyQ@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> <CACuKZqGhBN5SnuUEyRccaqQiBP1tE8r=K+9ioFGikG60a9bFyQ@mail.gmail.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Wed, 26 Feb 2014 10:37:46 +0900
Message-ID: <CAH9hSJZh1KwTPqrn+vvTOG4878foaXChPrgTf01zaJPRmsKdsw@mail.gmail.com>
To: Zhong Yu <zhong.j.yu@gmail.com>
Content-Type: multipart/alternative; boundary="001a1134d69ca672fb04f345410c"
Archived-At: http://mailarchive.ietf.org/arch/msg/hybi/BzNTxUsRCNf23ZHRqa5PWit6ACs
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 01:38:10 -0000

On Wed, Feb 26, 2014 at 9:54 AM, Zhong Yu <zhong.j.yu@gmail.com> wrote:

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

The "queue" referred by some texts in the WebSocket API spec is also
underspecified. It doesn't say the queue is not used by close frame
sending. Chromium uses the same queue. There can be implementations that
allow a close frame overtake buffered data. Then, you're right.


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

The API should have some method to get notified of full/partial drain of
the buffer. Also, it's said to be an issue that there's no way to know how
much the upper limit of buffer size is on the UA in use.


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