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.