[whatwg] Collection garbage on WebSockets

Simon Pieters simonp at opera.com
Mon Jun 28 08:32:32 PDT 2010

On Mon, 28 Jun 2010 16:42:45 +0200, Wellington Fernando de Macedo  
<wfernandom2004 at gmail.com> wrote:

> Em 28/06/2010 11:28, Simon Pieters escreveu:
>>>   * When at least one open or message events has been received, and  
>>> there are
>>> close events listeners (the close event could be flagged as 'strong'  
>>> in this
>>> case);
>> You can get close event without an open event first. (I don't think  
>> Firefox gets this right currently.)
> That situation only can happen (in Firefox) when the js script calls the  
> Close() method and the readyState == CONNECTING.
> When the connection can't be established for any reason the WebSocket  
> object stays in the CONNECTING
> readyState and doesn't dispatch any events. That behavior is because of  
> the section "6.1. Client-initiated closure"
> of the WebSocket protocol spec, in order to prevent script to  
> distinguish any of the situations listed there.

AFAICT, the spec requires a close event to be fired if the connection  
fails for any reason. It's just that the API shouldn't expose the reason  
for the close to Web pages.

>> Also see  
>> http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-May/026400.html  
>> (we have implemented this policy).
> Thanks!
> Wellington.

Simon Pieters
Opera Software

More information about the whatwg mailing list