eclipse / paho.mqtt-sn.embedded-c

Paho C MQTT-SN gateway and libraries for embedded systems. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
314 stars 179 forks source link

Gateway assigns non-zero topic ID for wildcard topics #221

Closed vera closed 3 years ago

vera commented 3 years ago

When the gateway receives a SUBSCRIBE for a topic containing wildcards, it responds with a SUBACK containing a non-zero topic ID. The specification states (Section 5.4.16, pages 15-16):

TopicId: in case of “accepted” the value that will be used as topic id by the gateway when sending PUBLISH messages to the client (not relevant in case of subscriptions to a short topic name or to a topic name which contains wildcard characters)

Since this is a waste of a topic ID, imho it would be preferable to set the topic IDs of wildcard topics to zero.

Edit: Actually found a more explicit statement in the specification (page 23):

If the client subscribes to a topic name which contains a wildcard character, the returning SUBACK message will contain the topic id value 0x0000.

ty4tw commented 3 years ago

Hi,

I will fix it.

campescassiano commented 1 year ago

When I am subscribing to a wildcard topic, I get the SUBACK back with topic-id == 0x00; However, I am also getting the msg-id == 0x00, is that correct?