← Back to team overview

mosquitto-users team mailing list archive

Re: Getting the client ID of messages received

 

Hello Roger,

On Wed, Jul 25, 2012 at 11:12 AM, Roger Light <roger@xxxxxxxxxx> wrote:

> This isn't a limitation of the library, it is the design of the protocol.
> There is no built in way to determine which client is sent a message. You
> could use a specific topic or include information in your payload if this
> is important to you.
>
Indeed, if I understand correctly the protocol definition, it says that
PUBLISH messages don't contain this client ID field -- and that's
*this*kind of messages that are forwarded to MQTT "consumers".

Now, my question is: doesn't that somewhat contradict with the common use
case of this protocol, i.e. "where the network is expensive, has low
bandwidth or is unreliable".

Maybe a workaround would be to have a modified broker which would alter the
payload of PUBLISH messages before forwarding them. And that would
*have*to be done inside the broker as the information is only known to
it.

That makes me wondering if there's an easy way in the Mosquitto broker to
plug in some programmable hooks, to modify / monitor message exchanges for
example? I don't think so. So what do you think of the idea of adding some
Lua scripting capability into the Mosquitto broker? The runtime library is
compact and it's a very popular scripting engine for this kind of work.

By the way, this whole "client ID discussion" make me think on how to *
choose* a "proper" ID. Basically, what was the goal of the authors of MQTT
when they added this "client ID" field?
What would be a intelligent use of it? How to avoid ID collisions, etc?
There must a reason why it's in the spec :-)

Regards,

-- 
Damiano ALBANI

Follow ups

References