pingRequestReceived method

bool pingRequestReceived(
  1. MqttMessage? pingMsg
)

Signal to the keepalive that a ping request has been received from the message broker. The effect of calling this method on the keepalive handler is the transmission of a ping response message to the message broker on the current connection.

Implementation

bool pingRequestReceived(MqttMessage? pingMsg) {
  if (_shutdownPadlock) {
    return false;
  } else {
    _shutdownPadlock = true;
  }
  final pingMsg = MqttPingResponseMessage();
  _connectionHandler.sendMessage(pingMsg);
  _shutdownPadlock = false;
  return true;
}