Interface MqttListener


public interface MqttListener
Receives the life cycle and the messages of an MqttClient. Every method is called on the Codename One EDT.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The broker accepted the connection (CONNACK with return code 0).
    void
    The connection ended without a call to MqttClient.disconnect(): the transport failed, the broker refused the connection, a packet was malformed or the keep alive was not answered.
    void
    messageArrived(String topic, byte[] payload, boolean retained)
    A message arrived for a subscription that has no listener of its own.
  • Method Details

    • connected

      void connected()
      The broker accepted the connection (CONNACK with return code 0). Messages queued while disconnected are re-sent right after this call returns to the client.
    • messageArrived

      void messageArrived(String topic, byte[] payload, boolean retained)

      A message arrived for a subscription that has no listener of its own.

      Parameters
      • topic: the topic name the message was published to

      • payload: the message body

      • retained: true when the broker sent it from its retained store

    • connectionLost

      void connectionLost(String reason)

      The connection ended without a call to MqttClient.disconnect(): the transport failed, the broker refused the connection, a packet was malformed or the keep alive was not answered.

      Parameters
      • reason: a human readable description