W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2010

[whatwg] WebSocket bufferedAmount includes overhead or not

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Thu, 25 Mar 2010 20:26:06 +0200
Message-ID: <4BABAABE.90206@helsinki.fi>
On 3/25/10 5:55 PM, Anne van Kesteren wrote:
> On Thu, 25 Mar 2010 16:35:19 +0100, Olli Pettay
> <Olli.Pettay at helsinki.fi> wrote:
>> On 3/25/10 4:25 PM, Niklas Beischer wrote:
>>> Easy. The bufferedAmount is: "The amount of bytes waiting to be
>>> transferred, including protocol overhead".
>> That doesn't define exactly what the bufferedAmount means and what
>> kinds of values are expected.
>> What I'd expect the API to tell me is, for example, that if I call
>> ws.send(foo), and nothing is yet sent over the network, what is the
>> exact value of bufferedAmount.
>> Again, I'd really wish to keep the API to work reasonable similar
>> way as XHR+progress events where protocol overhead isn't reported.
>
> Why? Progress events are completely different from this. This is about
> not saturating the network with too much data; it makes sense if the
> actual amount of data that is going to hit the network is known.

bufferedAmount is not only about "not saturating".

Let's put the question otherway around:
from API point of view, why should bufferedAmount contain some bytes
which aren't specified in the API spec?
If the API specifies that bufferedAmount is always 
to_be_sent_data_in_UTF8_length+(1 or 2), that would be sort of ok.
Very very ugly, but ok.

Also, some implementations may not put the protocol
overhead bytes to the buffer at all, but just write them to the
socket when needed.



-Olli


  (Yes, I
> changed my mind.)
>
>
Received on Thursday, 25 March 2010 11:26:06 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:22 UTC