added connect and disconnect handlers for iOS clients