joewalnes/reconnecting-websocket — pull request #33 by uecasm (2014-12-15 05:08:45+00:00)
Title: Tidy up events

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.