Avoid generating two onclose calls on explicit close().
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?)
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.
onclose
calls on explicitclose()
.onconnecting
. (The first connect also firesonconnecting
, and can be distinguished withevent.code !== undefined
or similar; alternately maybe this should be a "reconnecting" event only?)error
event.Note that having the close reasons on
onconnecting
instead ofonclose
means that it's not completely API compatible withWebSocket
, but then it wasn't before either.