Rewrote error event

Now it will send either an error event, meaning the socket closed
unexpectedly, or a disconnect event meaning the socket closed properly,
never both.
Changed event handling to how it was before, with errors emitted on
fail.
Prevent reconnection while still connected