MQTTX icon indicating copy to clipboard operation
MQTTX copied to clipboard

[Bug] Set Topic Alias Max can not receive the message

Open RoanBrand opened this issue 2 years ago • 2 comments

What did I do

Specify a non-zero Topic Alias Max in CONNECT

What happened

Connects to server. Subscribe to # with no Local off. Publish to a topic.

Expected

Expect to see the pub msg sent back by the server and displayed as received msg. Instead see only the sent msg. With Wireshark can confirm server send valid PUBLISH to client, while including Topic Name and Topic Alias 1 to set at the client side. Subsequent msgs to same topic sent by server contains empty Topic Name with the same Topic Alias, as in accordance to spec, but client still does not accept it.

Also, the client does not seem to make use of Topic Aliases when sending pubs to the server. Which is fine, but maybe mention what features are missing or TODO on README or docs?

But what is crucial is that it is a bug (Protocol Violation) not to accept Topic Aliases, when non-zero value Topic Alias Max is specified at CONNECT

Environment

  • OS: Win10
  • MQTTX v1.8.2

More detail

image

RoanBrand avatar Aug 08 '22 16:08 RoanBrand

It looks like a bug in MQTT.js. The topicAliasMaximum must be under options.properties.topicAliasMaximum according to their interface and docs, but their code tries to get it from options.topicAliasMaximum. I opened a PR for them: https://github.com/mqttjs/MQTT.js/pull/1519

Maybe you can make a workaround until fixed? I can attempt one too, and make a PR here for it, but not sure the best way to go about it.

RoanBrand avatar Aug 08 '22 21:08 RoanBrand

Hi, I reproduced the problem and it seems that I am indeed not receiving the message, I saw your PR, thank you very much, I will test it locally.

ysfscream avatar Aug 09 '22 14:08 ysfscream

Thank you for your contribution, and we will follow up on the fix for mqtt.js, which is now in https://github.com/emqx/MQTTX/releases/tag/v1.8.3

ysfscream avatar Oct 12 '22 01:10 ysfscream