- From: Olli Pettay <Olli.Pettay@helsinki.fi>
- Date: Thu, 18 Feb 2010 14:56:16 +0200
- To: public-webapps@w3.org, Ian Hickson <ian@hixie.ch>
Hi, 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? Or is the current behavior there just so that the example works; send new data whenever socket.bufferedAmount == 0. (Though the send may not actually send the data ever) The example could be a bit different var socket = new WebSocket('ws://game.example.com:12010/updates'); socket.onopen = function () { setInterval(function() { if (socket.readyState == WebSocket.OPEN && socket.bufferedAmount == 0) socket.send(getUpdateData()); }, 50); }; -Olli
Received on Thursday, 18 February 2010 12:56:57 UTC