ping method

  1. @override
Future<void> ping({
  1. required String topic,
})
override

Implementation

@override
Future<void> ping({required String topic}) async {
  _isInitialized();
  await _isValidPairingTopic(topic);
  if (pairings.keys.contains(topic)) {
    final id = await _sendRequest(
        topic, PairingMethod.WC_PAIRING_PING, {}, (_) => {});
    final completer = Completer<void>();
    final timer = completer.expirer();
    events.once(engineEvent(EngineEvent.PAIRING_PING, id), (data) {
      timer.cancel();
      if (data is ErrorResponse) {
        completer.completeError(data);
      } else {
        completer.complete();
      }
    });
    await completer.future;
  }
}