noPingResponseReceived method

void noPingResponseReceived()

Handle the disconnect timer timeout

Implementation

void noPingResponseReceived() {
  // Only disconnect if we are connected.
  if (_connectionHandler.connectionStatus.state ==
      MqttConnectionState.connected) {
    MqttLogger.log(
        'MqttConnectionKeepAlive::noPingResponseReceived - connected, attempting to disconnect');
    if (_clientEventBus != null) {
      _clientEventBus!.fire(DisconnectOnNoPingResponse());
      MqttLogger.log(
          'MqttConnectionKeepAlive::noPingResponseReceived - OK - disconnect event fired');
    } else {
      MqttLogger.log(
          'MqttConnectionKeepAlive::noPingResponseReceived - ERROR - disconnect event not fired, no event handler');
    }
  } else {
    MqttLogger.log(
        'MqttConnectionKeepAlive::noPingResponseReceived - not disconnecting, not connected');
  }
}