Upcoming Webinar: MQTT over QUIC: A New Standard for Connected Vehicles
Upcoming Webinar: MQTT over QUIC: A New Standard for Connected Vehicles
Register Now →

Payload Format Indicator and Content Type | MQTT 5.0 New Features

EMQX Team EMQX Team Sep 6, 2019
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.

Try EMQX Cloud for Free
A fully managed, cloud-native MQTT service
Get Started →

Related Posts

Apr 15, 2020 EMQX Team
The process of publishing MQTT 5.0 message

The MQTT 5.0 protocol has made some upgrades for part of QoS packet, and the processes of dealing with packets, this article below display some simple introduction about the content of upgrades.

Sep 18, 2020 Zibo Zhou
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.

Nov 25, 2021 Shifan Yu
User Properties - MQTT 5.0 new features

User Properties are the user-defined properties that allow users to add their metadata to MQTT messages to expand more application scenarios.