emit any error immediately

It seems like the ws library for node.js does not precisely follow the
procedure followed by the WebSocket implementation in the DOM.  When an
error occurs there, the onclose event also fires.  Seems that is not the
case with ws.