call function

Future call(
  1. String to, {
  2. dynamic data,
  3. String? resp,
  4. Duration? timeout,
})

Implementation

Future<dynamic> call(String to,
    {dynamic data, String? resp, Duration? timeout}) async {
  var rpath = resp ?? '#resp.${++_atomic}';

  var f = wait([rpath], sticky: false, timeout: timeout);
  publish(to, data: data, rpath: rpath, sticky: false);
  var ret = await f;
  if (ret is Exception || ret is Error) {
    if (ret is StackException) {
      throw await Future.error(ret.exception, ret.stackTrace);
    } else {
      throw ret;
    }
  }
  return ret;
}