Unfortunately, we could not use the readyState for checking reachability.
This is because the detection of unexpected disconnection is based on TCP.
It might be possible to close on machine's waking up explicitly, but
still there will
be many situations where you could not communicate with the server through
readyState is OPEN. CLOSED state and close event is useful only for
verification of graceful connection close.
To check reachability, you could implement heartbeats in your subprotocols.
The latest spec has a frame definition for ping and pong. It's not
clear now that
how these frames should be used. If this feature is exposed to JavaScript API,
you could use it for ping-pong outside of your subprotocols.
Also, you might be interested in following discussion.
http://code.google.com/p/chromium/issues/detail?id=76358 .
> --
> You received this message because you are subscribed to the Google Groups
> "Chromium HTML5" group.
> To post to this group, send email to chromiu...@chromium.org.
> To unsubscribe from this group, send email to
> chromium-html...@chromium.org.
> For more options, visit this group at
> http://groups.google.com/a/chromium.org/group/chromium-html5/?hl=en.
>
You can discuss about API specification, here.
http://www.w3.org/Bugs/Public/show_bug.cgi?id=12102
I mentioned similar idea as Comment 36.