[whatwg] WebSocket bufferedAmount includes overhead or not.
Olli.Pettay at helsinki.fi
Thu Mar 4 01:52:02 PST 2010
On 3/4/10 4:42 AM, Fumitoshi Ukai (鵜飼文敏) wrote:
> I noticed that WebSocket spec updated to not inlcude framing overhead in
I asked that since from API point of view it doesn't make
much sense to have the frame bytes to be magically included in the
What if we change the protocol and require different amount framing
Also why to have framing bytes and not the bytes related to http handling?
Also, XHR+progress events don't include http headers etc in the
.loaded or .total.
> I tried to implement it in WebKit, but found it make hard to implement
Not hard at all in gecko's implementation (the patch is still waiting
for a review and will be possibly updated to include the latest
changes to the protocol before pushing to hg repo).
> It's easy after WebSocket is closed (just add length of message),
> while it's open, we'll manage buffer including frame bytes
In the patch for gecko there is a different buffer for each
"message", so it is easy to count how many frame bytes are in the
> underlying socket will write arbitrary length of the buffer (may not be
> on frame boundary)
> To get bufferdAmount correctly without framing overhead, we need to
> parse the buffer again. It's not light operation and it's challenge to
> make it effective.
> I think including frame overhead is much easier.
> Could you revert it?
That would make the API worse, especially for web developers, IMO.
They shouldn't need to know about the protocol, they should just be able
to use the API and understand easily what bufferedAmount means.
> Fumitoshi Ukai
More information about the whatwg