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



Reply via email to