joewalnes / reconnecting-websocket

A small decorator for the JavaScript WebSocket API that automatically reconnects
MIT License
4.23k stars 967 forks source link

Tidy up events #33

Closed uecasm closed 9 years ago

uecasm commented 9 years ago
  1. Avoid generating two onclose calls on explicit close().
  2. On disconnect, make the close reason available to onconnecting. (The first connect also fires onconnecting, and can be distinguished with event.code !== undefined or similar; alternately maybe this should be a "reconnecting" event only?)
  3. Correct typo in generation of error event.

Note that having the close reasons on onconnecting instead of onclose means that it's not completely API compatible with WebSocket, but then it wasn't before either.

joewalnes commented 9 years ago

Thanks!