Skip to content

v1.0.5

Compare
Choose a tag to compare
@github-actions github-actions released this 14 Jan 09:59
· 3 commits to master since this release
2bc6c76

Release of v1.0.5 adds support for:

  1. fix multi levels wildcard support that must also match zero level (details).
  2. add support for single level wildcard '+' sign.

Thanks to @lpapier for the PR (#36)

Usage

See tests/subscribe.nim for examples on use.

Details

http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#appendix-a

Multi-level wildcard
The number sign (#) is a wildcard character that matches any number of levels within a topic. For example, if you subscribe to finance/stock/ibm/#, you receive messages on these topics:

  1. finance/stock/ibm
  2. finance/stock/ibm/closingprice
  3. finance/stock/ibm/currentprice
    The multi-level wildcard can represent zero or more levels. Therefore, finance/# can also match the singular finance, where # represents zero levels. The topic level separator is meaningless in this context, because there are no levels to separate.

The multi-level wildcard can be specified only on its own or next to the topic level separator character. Therefore, # and finance/# are both valid, but finance# is not valid. The multi-level wildcard must be the last character used within the topic tree. For example, finance/# is valid but finance/#/closingprice is not valid.

Single-level wildcard
The plus sign (+) is a wildcard character that matches only one topic level. For example, finance/stock/+ matches finance/stock/ibm and finance/stock/xyz, but not finance/stock/ibm/closingprice. Also, because the single-level wildcard matches only a single level, finance/+ does not match finance.

The single-level wildcard can be used at any level in the topic tree, and in conjunction with the multilevel wildcard. It must be used next to the topic level separator, except when it is specified on its own. Therefore, + and finance/+ are both valid, but finance+ is not valid. The single-level wildcard can be used at the end of the topic tree or within the topic tree. > For example, finance/+ and finance/+/ibm are both valid.