call method

  1. @override
Future<RealtimeResult> call(
  1. String op, {
  2. Map<String, String> params = const {},
  3. Object? body,
  4. String? ifMatch,
  5. String? id,
  6. Duration? timeout,
})
override

Calls REST operation op over the socket (envelope id = idempotency key id).

Implementation

@override
Future<RealtimeResult> call(
  String op, {
  Map<String, String> params = const {},
  Object? body,
  String? ifMatch,
  String? id,
  Duration? timeout,
}) async {
  final r = await _emit('call', {
    'op': op,
    if (params.isNotEmpty) 'params': params,
    'body': ?body,
    'ifMatch': ?ifMatch,
    'id': ?id,
  }, timeout);
  final m = r is Map ? r.cast<String, Object?>() : const <String, Object?>{};
  return RealtimeResult(
    (m['status'] as int?) ?? 200,
    m['body'],
    etag: m['etag'] as String?,
  );
}