heartbeat method

Future<void> heartbeat(
  1. String callId,
  2. JsonMap data
)

心跳:经长连接 2 秒内没有回应或长连接不可用时用客户端 API。

Implementation

Future<void> heartbeat(String callId, JsonMap data) async {
  if (core.conn.authenticated) {
    try {
      await core.conn.request<Object?>('rtc.heartbeat', data, _heartbeatWsTimeoutMs);
      return;
    } on DRException catch (err) {
      if (!_transientSignal.contains(err.code)) rethrow;
    }
  }
  final body = Map<String, Object?>.of(data)..remove('call_id');
  await core.request<Object?>(ApiRequest('POST', '/client/v1/calls/${enc(callId)}/heartbeat', body: body));
}