Payload Format Indicator and Content Type - MQTT 5.0 new features

Payload Format Indicators and Content Type are two new properties introduced in MQTT 5.0.

Payload Format Indicator

In all packet types of MQTT 5.0, this property exists only in the will property of PUBLISH packet and CONNECT packet.

Payload Format Indicator occupies only one byte size, and has only two values, 0 (0x00) and 1 (0x01).

In the MQTT CONNECT packet, when the value of the Payload Format Indicator of the will property is 0, it means that the will message is an undetermined byte. When the value of the property is 1, it means that the test message is UTF-8 encoded character data. The data in Will Payload must conform to the definition of standard UTF-8.

In the MQTT PUBLISH packet, when the value of the Payload Format Indicator of the PUBLISH property is 0, it means that the PUBLISH message is an undetermined byte. When the value of the property is 1, it means that the payload of the PUBLISH packet is UTF-8 encoded character data. The data in the Payload of PUBLISH packet must conform to the definition of the standard UTF-8.

Content Type

In all packet types of MQTT 5.0, this property also exists only in the will property of PUBLISH packet and CONNECT packet. This property stores UTF-8 encoded strings that describe the contents of a will message or a PUBLISH message.

It is determined by the application that sends and receives messages. The content type cannot be tampered with during message forwarding.

A typical application of content types is to store MIME types, such as text/plain for text files and audio/aac for audio files.

Did you like this blog post? Share it now

Related Posts

Introduction to MQTT 5.0

Four years after the MQTT 3.1.1 has been released and became the OASIS standard, MQTT 5.0 was released, which is a significant improvement and upgrade.

Zibo Zhou 2020-09-18
MQTT 5.0 Features of Inflight Window & Message Queue

When the simultaneously existing packets in the network link exceeds the limit, that is, the Inflight Window reaches its length limit of the (see `max_inflight`), the EMQ X broker will no longer send subsequent packets, but will store these packets in the Message Queue.

2020-03-31
Flow control - MQTT 5.0 new features

MQTT 5.0 brings many new features, this article will give an introduction to the use of the new feature "flow control" in an easy-to-understand way.

Zibo Zhou 2020-08-11