lint fixes
improved connection logic
on connect client can only handle error once
Add client.close()
Use 'serverError' event for server error messages, leave 'error' for low level errors