retransmitEventsTo method

Future<VIRetransmitEvent> retransmitEventsTo(
  1. int to,
  2. int count
)

Request a number of events up to 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.

to - Last 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> retransmitEventsTo(int to, int count) async {
  try {
    Map<String, dynamic>? data = await _methodChannel.invokeMapMethod(
        'Messaging.retransmitEventsTo',
        {'conversation': uuid, 'to': to, '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);
  }
}