Lii
Lii

Reputation: 12112

How to display binary MQTT data?

I am using the Mosquitto command mosquitto_sub to display data from an MQTT server:

mosquitto_sub -t "#" -v

The messages I want to display contains binary data, which Mosquitto tries to display as text.

Is there any way to display the MQTT messages in a better way for binary data? For example as the hex-values of the bytes?

Upvotes: 0

Views: 4384

Answers (1)

hardillb
hardillb

Reputation: 59608

The mosquitto_sub man page has a section called "Output format" which covers this.

You can use the -F option to specify a formatting string.

e.g.

mosquitto_sub -v -t '#' -F %X

Upvotes: 4

Related Questions