net.sf.xenqtt.client
Interface AsyncClientListener

All Superinterfaces:
MqttClientListener

public interface AsyncClientListener
extends MqttClientListener

Implement this interface to use the AsyncMqttClient. The client will invoke the methods in this interface when various events happen. A single instance of this interface may be used with multiple clients.


Method Summary
 void connected(MqttClient client, ConnectReturnCode returnCode)
          Called after the client has received a connect acknowledgment from the broker.
 void published(MqttClient client, PublishMessage message)
          Called when the protocol to send a client publish message to the broker is complete.
 void subscribed(MqttClient client, Subscription[] requestedSubscriptions, Subscription[] grantedSubscriptions, boolean requestsGranted)
          Called when the client receives a subscribe acknowledgment from the broker.
 void unsubscribed(MqttClient client, String[] topics)
          Called when an unsubscribe acknowledgment is received from the broker.
 
Methods inherited from interface net.sf.xenqtt.client.MqttClientListener
disconnected, publishReceived
 

Method Detail

connected

void connected(MqttClient client,
               ConnectReturnCode returnCode)
Called after the client has received a connect acknowledgment from the broker.

Parameters:
client - The client that is connected
returnCode - The connect return code from the broker. Anything other than ConnectReturnCode.ACCEPTED will result in the client being immediately disconnected.

subscribed

void subscribed(MqttClient client,
                Subscription[] requestedSubscriptions,
                Subscription[] grantedSubscriptions,
                boolean requestsGranted)
Called when the client receives a subscribe acknowledgment from the broker.

Parameters:
client - The client that requested the subscriptions
requestedSubscriptions - The subscriptions requested. The topics will be the same as those in grantedSubscriptions and the QoS will be the QoS the client requested.
grantedSubscriptions - The subscriptions. The topics will be the same as in requestedSubscriptions but the QoS will be the QoS granted by the broker, not the QoS requested by the client.
requestsGranted - True if the requested QoS for each topic matches the granted QoS. False otherwise.

unsubscribed

void unsubscribed(MqttClient client,
                  String[] topics)
Called when an unsubscribe acknowledgment is received from the broker.

Parameters:
client - The client that requested the unsubscribe
topics - The topics unsubscribe from. These may include wildcards.

published

void published(MqttClient client,
               PublishMessage message)
Called when the protocol to send a client publish message to the broker is complete.

Parameters:
client - The client the message was published to
message - The message that was published. This will be the same object passed to MqttClient.publish(PublishMessage).


Copyright © 2013. All Rights Reserved.