I've had a query about retained messages. If a broker receives a
message to be retained, any clients that are currently connected and
subscribed will be sent the message without the retain flag sent. If a
new client connects and subscribes to a topic, any existing retained
messages will be sent with the retained flag set. This essentially
means that the retained flag has two meanings. From a client to the
broker it means "retain this message". From the broker to a client it
means "this is message is not fresh".
This means that for a bridge, assuming it is always connected, the
messages it receives are always fresh and so will never have the
retained flag set. Any client then connecting to the remote broker
will not receive retained messages. The person making the query thinks
this is incorrect behaviour and I'm inclined to agree.
If I as the broker and creating the bridge then any messages I pass
outwards can be modified to have the retain flag set because I know
that the connection is a bridge. Is this appropriate behaviour?
In the other direction it is not quite so easy. If I could determine
that a client connected to me is a bridge then the problem is solved.
I could do this by adding something to the protocol to indicate that a
client is a bridge or by monitoring for incoming messages that are in
the topic $SYS/broker/connections/, assuming the bridging broker
supports that feature. I could also use my own protocol version number
to deal with inter broker communication - I believe that this is what
rsmb does, presumably for these kinds of reasons.
To end with a question - should there be some way of determining if a
client is a bridge and how should this be done? Should I be
propagating messages to bridges with the retained flag set even if
they aren't stale?
Thanks,
Roger
--To learn more about MQTT please visit http://mqtt.orgTo post to this group, send email to mq...@googlegroups.comTo unsubscribe from this group, send email toFor more options, visit this group at