MqttData Transport Service Configuration
The MqttDataTransport service provides the ability to connect to a remote broker, publish messages, subscribe to topics, receive messages on the subscribed topics, and disconnect from the remote message broker. To use this service, select the MqttDataTransport option located in the Cloud Services area as shown in the screen captures below.
The MqttDataTransport service provides the following configuration parameters:
-
broker-url - defines the URL of the MQTT broker to connect to. For the Everyware Cloud sandbox, this address is either mqtt://broker-sandbox.everyware-cloud.com:1883/ or mqtts://broker-sandbox.everyware-cloud.com:8883/ for an encrypted connection. (Required field.)
-
topic.context.account-name - defines the name of the account to which the device belongs.
-
username and password - define the username and password that have been assigned to the device by the account administrator (generally username is account-name_broker). (Required field.)
-
client-id - defines the identifier of the MQTT client representing the device when connecting to the MQTT broker. If left empty, it is automatically determined by the client software as the MAC address of the main network interface (in general numbers and uppercase letters without ':'). This identifier has to be unique within your account. (See screen capture below.)
- keep-alive - defines the maximum time interval, in seconds, that the client is allowed to remain silent. In the absence of other outgoing MQTT control packets, the client sends a PINGREQ packet that the broker acknowledges.
The client and the broker reciprocally use three halves (1.5) of the keep-alive interval to timeout their inactivity and forcibly disconnect. (Required field.)
Keep-alive Interval and Network Idle Timeouts
In selecting a keep-alive interval one must take into account network idle timeouts and meet the following constraints:
- The keep-alive interval MUST NOT exceed two-thirds (2/3) of any idle connection timeout configured in the endpoint that terminates the associated TCP connection (see this AWS article)
- The keep-alive interval MUST NOT exceed two-thirds of the Disconnect if Idle timeout configured in the cellular configuration
-
timeout - sets the timeout used for all interactions with the MQTT broker. (Required field.)
-
clean-session - controls the behavior of both the client and the server at the time of connection and disconnection. When this parameter is set to true, the state information is discarded at connection and disconnection; when set to false, the state information is maintained. (Required field.)
-
lwt parameters - define the MQTT "Last Will and Testament" (LWT) settings for the client. In the event that the client unexpectedly loses its connection to the server, the server publishes the LWT message (lwt.payload) to the LWT topic on behalf of the client. This allows other clients (subscribed to the LWT topic) to be made aware that the client has disconnected. LWT parameters that may be configured include:
- lwt.topic
- lwt.payload
- lwt.qos
- lwt.retain
-
in-flight.persistence - defines the storage type where in-flight messages are persisted across reconnections. They may be stored in memory, or in a file on the disk. (Required field.)
-
protocol-version - defines the MQTT Protocol version to be used. This value may be 3.1 or 3.1.1 (April 2014).
-
SSL parameters - define the SSL specific settings for the client. SSL parameters that can be configured include:
- ssl.default.protocol
- ssl.hostname.verification
- ssl.default.cipherSuites
- ssl.certificate.alias
Updated almost 3 years ago