Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Topic aliasing on messages sent out by Mosquitto

Hi Wiebe,

The subscribing client has to tell the broker that it is capable of
handling aliases by setting the topic-alias-maximum property in its
CONNECT. In mosquitto_sub that would be:

mosquitto_sub -d -V 5 -t \$SYS/broker/uptime -D connect topic-alias-maximum 10

You need to use wireshark or similar to see the alias operating,
because the library will do the substitution for you before you see
the topic, so the logs look correct for example.

The max_topic_alias_broker option sets an upper limit on what the
broker allows a subscribing client to set the maximum. Without this,
every client could ask for 65535 topic aliases, for example.

It will be part of 2.1, which I'm working on at the moment.

Regards,

Roger

On Thu, 27 May 2021 at 14:32, Wiebe Cazemier <wiebe@xxxxxxxxxxxx> wrote:
>
> ________________________________
>
> From: "Roger Light" <roger@xxxxxxxxxx>
> To: "General development discussions for the mosquitto project" <mosquitto-dev@xxxxxxxxxxx>
> Sent: Monday, 22 March, 2021 18:28:25
> Subject: Re: [mosquitto-dev] Topic aliasing on messages sent out by Mosquitto
>
> Hi Vera,
>
> That's an interesting idea - and easily achieved with user-properties.
>
> I've just pushed a version to the develop branch which just limits topic to a maximum count, set to 10 by default.
>
> Options max_topic_alias_broker and bridge_max_topic_alias are the ones to look at if you want to test it out.
>
> Cheers,
>
> Roger
>
>
> Hi Roger,
>
> Thanks for including this.
>
> I compiled the develop branch (commit 5177dd4d) and had a test between two brokers (whether a bridge negotiates aliases). It was kind of hard to diagnose because neither broker writes debug messages about having negotiated topic aliases, but I used tcpdump to analyze the traffic, and in a chain of mosquitto_pub -> broker1 -> broker2, the topic name disappears after the first publish. The tcpdump was between broker1 and broker2.
>
> However, how is 'max_topic_alias_broker' supposed to work (so for normal subscribers)? When I start a local broker and subscribe with debug:
>
>   ./mosquitto_sub -d -V mqttv5 -d -t '#' -i subber [--property publish topic-alias 10]
>
> I see:
>
>   Client subber received PUBLISH (d0, q0, r0, m0, 'P/fc6947c40ffb/out/bla/long/longlong/long/long', ... (45 bytes))
>   [Thu 2021-May-27 15:24:06 CEST first publish]
>   Client subber received PUBLISH (d0, q0, r0, m0, 'P/fc6947c40ffb/out/bla/long/longlong/long/long', ... (46 bytes))
>   [Thu 2021-May-27 15:24:08 CEST second publish]
>
> Do I misunderstand how 'max_topic_alias_broker' is supposed to work?
>
> And when all this works as expected, is it perhaps known already which version of Mosquitto will include this feature?
>
> Regards,
>
> Wiebe
>
>
>
>


Back to the top