Subscribing to topics¶
A client can subscribe to the exact topic of a published message. It can also use wildcards to subscribe to multiple topics simultaneously. There are two wildcards available:
Single level (+)¶
my-module/my-category/+/my-value
For the one topic level where the + wildcard is placed, any string matches.
Multi level (#)¶
A multi-level wildcard can only be placed as the last character in the topic. E. g.:
my-module/my-category/#
All topics that begin with my-module/my-category/ are subscribed now.
Special characters¶
There are only one reserved character (apart from /): $. Don't use it. In general try to use lower-case ASCII character and no spaces wherever possible.
Best practices¶
Never use a leading forward slash¶
This would introduce an additional unnecessary topic level.
Use lower-case ASCII characters¶
Like this topics always work. Also try to avoid spaces.
Use specific topics - don't subscribe to #¶
This would create a huge load. Try to specify the required topics as exact as possible.