peterhinch / micropython-mqtt

A 'resilient' asynchronous MQTT driver. Recovers from WiFi and broker outages.
MIT License
549 stars 116 forks source link

int topic #49

Closed jdtsmith closed 3 years ago

jdtsmith commented 3 years ago

Although the docs do mention "string topic", the in-built MQTT.simple allows integer topics as well, but this leads to an error with mqtt_as.

peterhinch commented 3 years ago

From the spec section 3.3.2.1:

The Topic Name MUST be present as the first field in the PUBLISH Packet Variable header. It MUST be a UTF-8 encoded string [MQTT-3.3.2-1] as defined in section 1.5.3.

You can of course convert an integer to a string.

In general these queries would be better put in the forum where they would be seen, and potentially answered, by more people. GitHub is really intended for bug reports.

jdtsmith commented 3 years ago

Of course I know how to work around it! My only point is that if you are intending to have mqtt_as serve as a near drop-in replacement for the bundled umqtt.simple (which presumably many will be porting from), it might be preferable to mirror its behavior, or at least provide a documentation warning for those who are porting. Thanks.