Interface MQTTClientCallback


public interface MQTTClientCallback
Callback interface for MQTT client lifecycle events.
Author:
Chris Burdess
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    connected(boolean sessionPresent, int returnCode)
    Called when the CONNACK is received and the connection is established.
    void
    Called when the connection is lost.
    void
    publishComplete(int packetId)
    Called when a publish is acknowledged (QoS 1 PUBACK or QoS 2 PUBCOMP).
    void
    subscribeAcknowledged(int packetId, int[] grantedQoS)
    Called when a SUBACK is received.
  • Method Details

    • connected

      void connected(boolean sessionPresent, int returnCode)
      Called when the CONNACK is received and the connection is established.
      Parameters:
      sessionPresent - whether a previous session exists on the server
      returnCode - the CONNACK return code (0 = accepted)
    • connectionLost

      void connectionLost(Exception cause)
      Called when the connection is lost.
      Parameters:
      cause - the exception, or null for clean disconnect
    • subscribeAcknowledged

      void subscribeAcknowledged(int packetId, int[] grantedQoS)
      Called when a SUBACK is received.
      Parameters:
      packetId - the subscribe packet identifier
      grantedQoS - the granted QoS levels
    • publishComplete

      void publishComplete(int packetId)
      Called when a publish is acknowledged (QoS 1 PUBACK or QoS 2 PUBCOMP).
      Parameters:
      packetId - the publish packet identifier