Handle errors

Handle errors on the SDK side instead of passing the whole response
along and letting the client determine whether an error happened.

Return an `EventEmitter` and pass along socket `error` and `end`
events from the socket.

Add `.connected`, indicating whether the client is connected.