startTimeout method

void startTimeout()

Schedule a timeout to be triggered if no reply occurs within the expected time frame.

Implementation

void startTimeout() {
  if (!_awaitingReply) {
    _channel
        .onPushReply(replyEvent)
        .then<void>(_receiveResponse)
        .catchError(_receiveResponse);
    _awaitingReply = true;
  }

  _timeoutTimer ??= Timer(timeout!, () {
    _timeoutTimer = null;
    _logger.warning('Push $ref timed out');
    _channel.trigger(Message.timeoutFor(ref));
  });
}