philipparndt / mqtt-analyzer

Apache License 2.0
92 stars 6 forks source link

Topic starts with a / #138

Closed harmi86 closed 2 years ago

harmi86 commented 2 years ago

Hi,

While testing the App, I had trouble to publish messages to a topic. I use the mosquito broker on my raspberry pi 4. Here I subscribed the topic „/test/topic“ and when I publish a message on the raspberry it was correctly shown in the app. Then I tried to publish a message in the app to the same topic but it was never shown on the raspberry. I tried to subscribe the topic „test/topic“ and then the messages were shown.

I use the version 2.6.0 but had the same issue in the official version.

philipparndt commented 2 years ago

Thanks for letting me know. This is an issue in the topic tree. When publishing the topic: /test the topic test is published.

According to the HiveMQ best practices you should not use a leading / as it is an empty topic. However, it should be supported and I will fix it 😉

philipparndt commented 2 years ago

@harmi86 I've uploaded a new Version (2.6.0 b129) to TestFlight. Do you like to test this?

harmi86 commented 2 years ago

I tested it and it is working now. Thanks a lot

maybe I should read the best practice 😂

philipparndt commented 2 years ago

Thanks for testing 👍

In my opinion, the leading slash meaning in MQTT is confusion. I guess the intention when using it is almost every time to have the topic at the root like you would have it in a file system.