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 TypeMethodDescriptionvoidThe broker accepted the connection (CONNACK with return code 0).voidconnectionLost(String reason) The connection ended without a call toMqttClient.disconnect(): the transport failed, the broker refused the connection, a packet was malformed or the keep alive was not answered.voidmessageArrived(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
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
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
-