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

[whatwg] WebSocket bufferedAmount includes overhead or not

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 31 Mar 2010 14:45:37 -0700
Message-ID: <l2x63df84f1003311445k7346a474maf454a789bd32f30@mail.gmail.com>
On Tue, Mar 30, 2010 at 11:20 PM, Niklas Beischer <no at opera.com> wrote:
> On Wed, 31 Mar 2010 09:38:21 +0300, Jonas Sicking <jonas at sicking.cc> wrote:
>
>> On Tue, Mar 30, 2010 at 9:56 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>>>
>>> On 3/30/10 10:22 AM, Jonas Sicking wrote:
>>>>
>>>> Making it implementation dependent is likely to lead to website
>>>> incompatibilities. Such as:
>>>>
>>>> ws = new WebSocket(...);
>>>> ws.onopen = function() {
>>>> ?ws.send(someString);
>>>> ?if (ws.bufferedAmount> ?X) {
>>>> ? ?doStuff();
>>>
>>> Can bufferedAmount not change due to data actually hitting the network
>>> during the execution of this code? ?As in, will all the someString data
>>> be
>>> buffered immediately after that send() call?
>>
>> I would have expected bufferedAmount to only change as a result of an
>> event being posted to the main event loop.
>
> I'm certainly no EcmaScript expert but now I'm confused. What event would
> that be? There is no 'onsent' event. Would bufferedAmount not change until
> there is an 'onerror' or 'onclosed' event?

No, an event that's internal to the implementation. See how event
queues work as defined by HTML5.

/ Jonas
Received on Wednesday, 31 March 2010 14:45:37 UTC

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