retransmitEvents method
Request events in the specified sequence range 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
to
- Last event in sequence range, inclusive
Throws VIException, if operation failed, otherwise returns VIRetransmitEvent instance. For all possible errors see VIMessagingError
Implementation
Future<VIRetransmitEvent> retransmitEvents(int from, int to) async {
try {
Map<String, dynamic>? data = await _methodChannel.invokeMapMethod(
'Messaging.retransmitEvents',
{'conversation': uuid, 'from': from, 'to': to});
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);
}
}