W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

Re: Websockets API / CloseEvent and readyState

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Wed, 14 Apr 2010 20:32:06 +0300
Message-ID: <4BC5FC16.70406@helsinki.fi>
To: Ian Hickson <ian@hixie.ch>, public-webapps@w3.org
No comments to this?

I wish the API will be changed and the awkward CloseEvent
interface will be removed.

-Olli

On 3/18/10 12:15 AM, Olli Pettay wrote:
> Hi all,
>
> I was wondering why to have .wasClean in
> close event. Is there really need for adding
> yet another event interface. Especially in this case
> when there are other quite simple options.
> For example:
> WebSocket could have state ERROR and then
> in the close event listener the script could check
> whether connection was closed normally, or whether the
> state is ERROR and based on that try to reconnect.
>
> In the script the change would be from
> function closelistener(e) {
> if (e.wasClean) {
> dosomething();
> } else {
> reconnect();
> }
> }
>
>
> to
> function closelistener(e) {
> if (this.readyState == this.CLOSED) {
> dosomething();
> } else {
> reconnect();
> }
> }
>
> .wasClean feels and sounds bad :/
>
> -Olli
>
>
>
>
Received on Wednesday, 14 April 2010 17:32:44 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:38 GMT