[whatwg] WebSocket: Events instead of polling bufferedAmount?
ivan at ludios.org
Thu Mar 25 15:23:07 PDT 2010
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.
More information about the whatwg