Aside: Naming things in MQTT

The official MQTT protocol has its own rules for naming things and in MQTT the things we're concerned with are called "Topic Names". If you read Todd's blog post on MQTT in Adafruit IO, you'll know we are like an MQTT broker, but we've got some extra guidelines.

You don't need to memorize the official rules, we handle it for you under the hood. But here they are for illustration:

  • All Topic Names and Topic Filters MUST be at least one character long
  • Topic Names and Topic Filters are case sensitive
  • Topic Names and Topic Filters can include the space character
  • A leading or trailing ‘/’ creates a distinct Topic Name or Topic Filter
  • A Topic Name or Topic Filter consisting only of the ‘/’ character is valid
  • Topic Names and Topic Filters MUST NOT include the null character (Unicode U+0000)
  • Topic Names and Topic Filters are UTF-8 encoded strings, they MUST NOT encode to more than 65535 bytes

Retrieved from the MQTT Version 3.1.1 OASIS Standard, July 8, 2016.

 

The full MQTT topic used to describe a Feed in Adafruit IO is in the form, username/feeds/identifier where username should be replaced with the username of the account that owns the Feed and identifier should be replaced with the Name or Key that uniquely identifies the Feed you're talking about.

So, MQTT considers the whole topic test_username/feeds/identifier when validating names but for the purposes of describing Feeds, Adafruit IO is only considering the identifier portion.

This guide was first published on Jul 15, 2016. It was last updated on Jul 15, 2016. This page (Aside: Naming things in MQTT) was last updated on Sep 28, 2019.