ping method
Future<bool>
ping({
- Duration timeout = const Duration(seconds: 1),
- PingRequest? request,
inherited
Pings the peer, and returns whether or not it responded within
timeout
.
The returned future completes after one of the following:
- The peer responds (returns
true
). - The
timeout
is exceeded (returnsfalse
).
If the timeout is reached, future values or errors from the ping request are ignored.
Implementation
Future<bool> ping({
Duration timeout = const Duration(seconds: 1),
PingRequest? request,
}) => sendRequest<EmptyResult>(
PingRequest.methodName,
request,
).then((_) => true).timeout(timeout, onTimeout: () => false);