emqx / MQTTX

A Powerful and All-in-One MQTT 5.0 client toolbox for Desktop, CLI and WebSocket.
https://mqttx.app
Apache License 2.0
3.83k stars 443 forks source link

Subscription aliases don't seem to work correctly #1181

Open dustin opened 1 year ago

dustin commented 1 year ago

What did I do

Subscribed to topics with an alias limit set to request the broker to alias messages to the same topic.

This does require a broker that supports aliases, which I don't believe mosquitto does.

What happened

After the first message (establishing the aliases), subsequent messages don't properly report the topic.

Expected

If a message doesn't contain a topic, but contains an alias reference, then the alias should be dereferenced and the topic displayed.

Environment

Details

Subbed to tmp/# on broker.emqx.io and sent two messages:

mosquitto_pub -d -h broker.emqx.io -t tmp/x -m hello
mosquitto_pub -d -h broker.emqx.io -t tmp/x -m hello
Screenshot 2022-12-25 at 18 44 41

Compare to the output of my client subscribed at the same time:

tmp/x → hello
  TopicAlias 1
tmp/x → hello
  TopicAlias 1
ysfscream commented 1 year ago

Hi, sorry I'm late in replying. As I understand it, your mean it should eventually show the topic from which this message was received, right?

dustin commented 1 year ago

It should always show the topic. If it receives an empty topic with no known alias, there's a state mismatch between the client and the broker and he connection should be dropped. Otherwise, the client does know the topic and should display it.