← Back to team overview

mosquitto-users team mailing list archive

Re: Getting the client ID of messages received

 

Hi,

>> Suppose, you are monitoring the soil pH of various potted plants. The
>> monitoring device has a client ID based on the potted plant which you would
>> have designated in your own convenient way. That convenient way would also
>> ensure some uniqueness just as you were taking readings off a scientific
>> experiment.
>
>
> Indeed, that's a good example, a client ID for each monitoring device.
> But imagine that they are linked to their MQTT broker through an expensive
> satellite link, for example. I'd prefer not to waste bandwidth by including
> the client ID in the payload of each message.

I would suggest publishing to a topic with the client id in rather
than modifying the payload but that still requires effectively sending
the client id with each message. If bandwidth is really that critical
to you then you might be better off looking at mqtt-s which allows you
to register topics with the broker in advance so that you don't need
to send the full topic string with each message. There aren't any
freely available mqtt-s implementations yet though.

Cheers,

Roger


References