joinConversation method
Join the current user to any conversation specified by the UUID.
It's possible only on the following conditions:
- a conversation is created by a user of the main Voximplant developer account or its child accounts
- public join is enabled (VIConversation.publicJoin is true)
- the conversation is not a direct one (VIConversation.direct is false)
Other parties of the conversation (online participants and logged in clients) can be informed about joining to the conversation via the VIMessenger.onEditConversation callback.
uuid
- Conversation UUID
Throws VIException, if operation failed, otherwise returns VIConversationEvent instance. For all possible errors see VIMessagingError
Implementation
Future<VIConversationEvent> joinConversation(String uuid) async {
try {
Map<String, dynamic>? data = await _methodChannel
.invokeMapMethod('Messaging.joinConversation', {'uuid': uuid});
if (data == null) {
_VILog._e('VIMessenger: joinConversation: data was null, skipping');
throw VIException(
VIMessagingError.ERROR_INTERNAL,
'VIMessenger:joinConversation: data was null',
);
}
return VIConversationEvent._fromMap(data);
} on PlatformException catch (e) {
throw VIException(e.code, e.message);
}
}