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

[whatwg] WebSocket: Events instead of polling bufferedAmount?

From: Ivan Kozik <ivan@ludios.org>
Date: Thu, 25 Mar 2010 15:23:07 -0700
Message-ID: <badc170e1003251523p60918bb8rdd37ab991eeb2540@mail.gmail.com>
On Thu, Mar 25, 2010 at 3:01 PM, Ian Hickson <ian at hixie.ch> wrote:
> We could have an event that fires when bufferedAmount becomes zero
> (everything has been sent) or when bufferedAmount doesn't go down for a
> bit (stall), or resumes going down after a stall, but I would feel more
> comfortable waiting until WebSocket has been used for a while before
> adding such events, so that we could work out what it was people actually
> wanted to use, and then provide those.

I like the idea of firing an event when bufferedAmount becomes zero. It
might be good to have a method to configure to "target buffer size" that
the application wants, in case it's more than zero.

In the server-side world, Twisted works like this: when more than 2**16
bytes (by default) are buffered, it calls pauseProducing on the "registered
producer", and when it goes below this mark, it calls resumeProducing.

Received on Thursday, 25 March 2010 15:23:07 UTC

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