[whatwg] WebSocket bufferedAmount includes overhead or not

Jonas Sicking jonas at sicking.cc
Mon Mar 29 23:19:33 PDT 2010

On Wed, Mar 24, 2010 at 2:33 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Tue, 23 Mar 2010, Anne van Kesteren wrote:
>> We (Opera) would prefer this too. I.e. to not impose details of the
>> protocol on the API.
> If we're exposing nothing from the protocol, does that mean we shouldn't
> be exposing that the string converts to UTF-8 either?

While exposing the fact that strings are sent as UTF-8 does say
something about the protocol, I think it's still much more protocol
independent than including the message headers. The string has to be
serialized in some way, and it seems unlikely that any newly developed
protocol in the foreseeable future would use anything other than UTF-8
as serialization.

I agree it's not perfect, but few things we do are :)

My understanding of the use case for bufferedAmount is to allow an
application to send large amounts of data without incurring large
amounts of latency. For example that you could send streams of mouse
movement coordinates without risking a high delay between a movement
and the information of the movement hits the wire.

It seems to me that bufferedAmount does fulfill that use case, whereas
simply a boolean 'hasBufferedData' wouldn't as well.

/ Jonas

More information about the whatwg mailing list