pingRequestReceived method

bool pingRequestReceived(
  1. MqttMessage? pingMsg
)

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

Implementation

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