Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Optional header mqtt message

Thanks for your quick response.

-----Original Message-----
From: mosquitto-dev <mosquitto-dev-bounces@xxxxxxxxxxx> On Behalf Of Ben Hardill
Sent: Freitag, 28. Mai 2021 12:00
To: mosquitto-dev@xxxxxxxxxxx
Subject: Re: [mosquitto-dev] Optional header mqtt message

This email originated from outside of your organization. Please do not click on links or open attachments unless you recognize the sender and know the content is safe.

It is not possible to add custom headers to MQTT v3.1 messages. The variable header holds different things based on the packet type and those fields are described in the section for that packet type in the spec, it can not to hold custom fields.

If you want to add custom headers then you need to use MQTT v5 which has message properties.;;sdata=XLRJfWatOj1mN5lFbA7HQeyxotSNWA4pn01QdaPcQwk%3D&amp;reserved=0

(Also as an aside it's bad form to start a topic with a leading '/', while it is legal according to the spec it leads to problems with things like shared subscriptions and MQTT URLs as it inserts a null element at the start of the topic, so get out of the habit as soon as possible)

On 28/05/2021 10:47, Philipp Halbritter wrote:
> Hi,
> currently I'm writing my master thesis about MQTT message tracing. 
> I've read through the MQTTV3.1 standard and I've seen that it is 
> possible to send a variable header in a MQTT message. My to that is: 
> Does the mosquitto broker keep the variable message header so it will 
> be delivered to all subscribers?
> Think of following scenario:
>   * P1 publishs to topic /test, S1 gets all message from topic /test
>   * P1 adds a variable header with a traceId to all of his messages
>   * Is S1 getting these variable headers as well?
> Sadly I couldn't find anything concerning this question in the 
> documentation.
> Thanks for your thoughts.
> Regards,
> Philipp
> _______________________________________________
> mosquitto-dev mailing list
> mosquitto-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit 
> ee9e09ce04033a64ac07073a91ecd%7C0%7C0%7C637577929782576088%7CUnknown%7
> CI6Mn0%3D%7C3000&amp;sdata=gjSrC4I7R2HaSprh%2FYUiFM5RauyGwnHohykfFamif
> uY%3D&amp;reserved=0

mosquitto-dev mailing list
To unsubscribe from this list, visit;;sdata=gjSrC4I7R2HaSprh%2FYUiFM5RauyGwnHohykfFamifuY%3D&amp;reserved=0

Back to the top