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

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.

https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901027

(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 https://www.eclipse.org/mailman/listinfo/mosquitto-dev


--
https://www.hardill.me.uk/wordpress
https://github.com/hardillb
https://about.me/hardillb
https://flickr.com/photos/hardillb/
https://keybase.io/hardillb


Back to the top