Kotlin

Fetch conversation events

Add getConversationEvents(conversation); call inside onSuccess callback inside getConversationEvents() method:

Add conversationEvents method to store conversation events:

Add getConversationEvents method to retrieve conversation events:

Above method adds events to conversationEvents collection and updates the view. Now add the missing updateConversationView method:

Events are stored in the conversationEvents property. You should remove these events after the logout. Update the body of the setConnectionListener and call conversationEvents.clear:

NOTE: In this tutorial, we are only handling member-related events NexmoMemberEvent and NexmoMessageEvent. Other kinds of events are being ignored in the above when expression (else -> null).