User Manual

If set to false (0) both the client and server will maintain state across restarts of the client, the server and the
connection. As state is maintained:
Message delivery will be reliable meeting the specified QOS even if the client, server or connection
are restarted.
The server will treat a subscription as durable.
If set to true (1) the client and server will not maintain state across restarts of the client, the server or the
connection. This means:
Message delivery to the specified QOS cannot be maintained if the client, server or connection are
restarted
The server will treat a subscription as non-durable
keepalive_sec: This value defines the maximum interval (in seconds) between messages being sent or received.
Setting a value here ensures that at least one message is sent between the client and the broker within every
'keep alive' period. If no data was sent within 'keepalive_sec' seconds, the Client will send a simple ping to the
broker to keep the connection alive. Setting this value to '0' disables the keep alive feature. The default value is
60 seconds.
Returns: 'True' (1) if the connection was successful, otherwise 'false' (0).
bool disconnect (void)
Disconnects from the remote MQTT broker.
Parameters: None
Returns: 'True' (1) if the disconnect was successful, otherwise 'false' (0) if an error occured (check .errno, .errstr, etc.).
Messaging
The following functions allow you to publish, subscribe and unsubscribe to MQTT topics:
bool publish ( UTF8String topic, UTF8String message, uint8_t qos =
MQTT_QOS_AT_MOST_ONCE, bool retained = false );
Published the supplied 'message' to the specified 'topic'.
Parameters:
topic: The topic where the data should be published (ex: "adafruit/data" or "home/rooms/bedroom/temp").
UTF8String is used to make it easier to work with UTF8 data.
message: The string of data to write to the specified 'topic'. UTF8String is used to make it easier to work with
UTF8 data.
qos: The quality of service level (see the MQTT spec for details). Default = 'At Most Once', meaning the message
tries to send once but isn't persisted if the send fails. Possible values are:
MQTT_QOS_AT_MOST_ONCE
MQTT_QOS_AT_LEAST_ONCE
MQTT_QOS_EXACTLY_ONCE
retained: Whether or not the published message should be 'retained' by the MQTT broker. Sending a message
with the retained bool set to 'false' (0) will clear any previously retained message from the broker. The default
value is false.
© Adafruit Industries https://learn.adafruit.com/introducing-the-adafruit-wiced-feather-wifi Page 113 of 202