Re: Web Sockets API, buffer handling after the connection is closed

On Thu, 18 Feb 2010, Olli Pettay wrote:
> 
> I wonder why send() needs to buffer anything after the connection is 
> closed. bufferedAmount is defined: "If the connection is closed, this 
> attribute's value will only increase with each call to the send() method 
> (the number does not reset to zero once the connection closes)"
> 
> Why not clear the buffer right after dispatching close event and then 
> throw if send() is called, or something similar?

It's so that if you write code that just sends continuously, you'll stop 
sending once the connection dies, even if you miss the close event.

The UA doesn't have to actually buffer, just keep increasing the number by 
the length each time you get a send while closed.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 18 February 2010 23:00:26 UTC