W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2010

Websockets API / CloseEvent and readyState

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Thu, 18 Mar 2010 00:15:37 +0200
Message-ID: <4BA15489.2090405@helsinki.fi>
To: public-webapps@w3.org
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, 17 March 2010 22:16:15 GMT

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