added connection.connect
moved connection.connect();
move connection.connect and connection.end
handleDisconnect
error changes
typo