add a hook called when a connection is ready