ping method
Implementation
@override
Future<void> ping(String topic) async {
_isInitialized();
await _isValidPing(topic);
if (client.session.keys.contains(topic)) {
final id = await _sendRequest<Map<String, dynamic>>(
topic,
JsonRpcMethod.WC_SESSION_PING,
{},
(v) => v,
);
final completer = Completer<void>();
final timer = completer.expirer();
events.once(
engineEvent(EngineEvent.SESSION_PING, id),
(data) {
timer.cancel();
if (data is ErrorResponse) {
completer.completeError(data);
} else {
completer.complete();
}
},
);
await completer.future;
} else if (client.core.pairing.pairings.keys.contains(topic)) {
await client.core.pairing.ping(topic: topic);
}
}