0
votes

To understand AWS IOT metering details I referred the following link

AWS IoT Core additional metering details [https://aws.amazon.com/iot-core/pricing/additional-details/#Messaging]

Issue 1: PUBACK

MQTT PUBACK (received from device) Metered as a single 5 KB message

MQTT PUBACK (sent by service) excluded from metering

Request you to explain the difference between the above two? As I understood PUBACK sent from AWS broker to device/ client only when device/client publishes to a topic with QOS = 1. So this should be sent by service is it correct? then what is PUBACK received from device? when the device sends PUBACK ? Please explain the communication flow for both cases.

Issue 2: PUBLISH

MQTT PUBLISH (received from device) Metered on the size of the payload and topic in bytes

MQTT PUBLISH (sent by service) Metered on the size of the payload and topic in bytes

As per my understanding, Client/device publishes the message to the broker i.e. received from device. Then what is PUBLISH sent by service ? Request you to explain communication flow for both cases?

1

1 Answers

0
votes

PUBLISH messages can go in either of two directions

  • from client to server, or
  • from server to client.

The case for server to client occurs if the client has subscribed to a topic and a message has been received on a matching topic. In this case the broker (server) sends the message using a PUBLISH message to the client.

The Details

Let's clarify the terminology here - the PUBACK and PUBLISH refer to MQTT message types.

A PUBLISH message (from http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718037) is (my emphasis added):

A PUBLISH Control Packet is sent from a Client to a Server or from Server to a Client to transport an Application Message.

A PUBACK message (from http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718043) is:

A PUBACK Packet is the response to a PUBLISH Packet with QoS level 1.

A PUBLISH message can be sent by either a device to the broker or by the broker to the device. If QoS is being used then the receiver sends a PUBACK back.

Request you to explain the difference between the above two? As I understood PUBACK sent from AWS broker to device/ client only when device/client publishes to a topic with QOS = 1. So this should be sent by service is it correct? then what is PUBACK received from device? when the device sends PUBACK ?

Both cases assume QoS 1:

MQTT PUBACK (sent by service) occurs after a device publishes to the broker. The broker sends a PUBACK back to the device.

MQTT PUBACK (received from device) is the case described above: a device has subscribed to a topic, the broker has received a message on that topic and the broker publishes the message to the device. The device sends a PUBACK in response back to the broker.

Then what is PUBLISH sent by service ?

This is the same case as above. The broker (service) is sending a message to the device after it has subscribed to the relevant topic.