subscribe method
Subscribe for other user(s) information and status changes.
It's possible to subscribe for any user of the main Voximplant developer account or its child accounts.
Other logged in clients (of the current user) can be informed about the subscription via the VIMessenger.onSubscribe callback. User(s) specified in the 'users' parameter aren't informed about the subscription.
users
- List of IM user ids
Throws VIException, if operation failed, otherwise returns VISubscriptionEvent instance. For all possible errors see VIMessagingError
Implementation
Future<VISubscriptionEvent> subscribe(List<int> users) async {
try {
Map<String, dynamic>? data = await _methodChannel
.invokeMapMethod('Messaging.subscribe', {'users': users});
if (data == null) {
_VILog._e('VIMessenger: subscribe: data was null, skipping');
throw VIException(
VIMessagingError.ERROR_INTERNAL,
'VIMessenger:subscribe: data was null',
);
}
return VISubscriptionEvent._fromMap(data);
} on PlatformException catch (e) {
throw VIException(e.code, e.message);
}
}