Send notifications when connecting/disconnecting

Since you won't get the response to a request after reconnecting, a client
needs to know when disconnection happens, so that it can handle the
request failure.
Block-based request/response API

Rather than adding yet another sprintf'd notification for handling
response errors, I added a block-based API that can handle both
success and errors.