retransmitEventsFrom method
Request a number of events starting with the specified sequence to be sent from the cloud to this client.
Only VIConversationEvent and VIMessageEvent events can be retransmitted; any other events can't be retransmitted.
The method is used to get history or missed events in case of network disconnect. Client should use this method to request all events based on the last event sequence received from the cloud and last event sequence saved locally (if any).
The maximum amount of retransmitted events per method call is 100. Requesting more than 100 events will cause VIException.
If the current user quits a VIConversation.uber conversation, messages that are posted during the user's absence will not be retransmitted later.
from
- First event in sequence range, inclusive
count
- Number of events
Throws VIException, if operation failed, otherwise returns VIRetransmitEvent instance. For all possible errors see VIMessagingError
Implementation
Future<VIRetransmitEvent> retransmitEventsFrom(int from, int count) async {
try {
Map<String, dynamic>? data = await _methodChannel.invokeMapMethod(
'Messaging.retransmitEventsFrom',
{'conversation': uuid, 'from': from, 'count': count});
if (data == null) {
_VILog._e('VIConversation: retransmitEvents: data was null, skipping');
throw VIException(
VIMessagingError.ERROR_INTERNAL,
'VIConversation:retransmitEvents: data was null',
);
}
return VIRetransmitEvent._fromMap(data);
} on PlatformException catch (e) {
throw VIException(e.code, e.message);
}
}