handle all connection events