当前位置:网站首页>[mqtt from introduction to improvement series | 08] mqtt3.1.1 topic details
[mqtt from introduction to improvement series | 08] mqtt3.1.1 topic details
2022-07-21 16:04:00 【I machine future】
This is the third of the future of machines 34 An article
The original address :http://t.csdn.cn/DwLgX
List of articles
1. The theme Topic
The topic level separator is used to introduce the structure into the topic name . If there is , It divides the topic name into multiple “ Subject level ”.
give an example : Valve status data topic :/topic/valve/state
Topic filters for subscriptions can contain special wildcards , Allows you to subscribe to more than one topic at a time .
Wildcards can be used in topic filters , But not in the subject name [MQTT-4.7.1-1] Use in
1.1 Topic level separator
- Forward slash (‘/’ U+002F) Used to separate each level in the topic tree , And provide a hierarchy for topic names .
- The topic level separator can appear anywhere in the topic filter or topic name .
topicName:/topic/valve/upload
topicFilter:/topic/valve/#
- Adjacent topic level separator (2 A continuous ’/') Indicates zero length topic level .
topicName:/topic/valve//control
1.2. Multi level wildcards #
- Number symbols (‘#’ U+0023) It's a wildcard , You can match any number of levels in the topic . Multi level wildcards represent parents and any number of children .
- Multi level wildcards must Specified separately Or in the After the topic level separator Appoint .
- In any case , It must be a topic filter [MQTT-4.7.1-2] Specified in the The last character
give an example :- List of topics
- sport/tennis/player1
- sport/tennis/player1/ranking
- sport/tennis/player1/score/wimbledon
- List of topics
Serial number | Example | Legal status | Adaptive theme | remarks |
---|---|---|---|---|
1 | sport/tennis/# | legal | sport/tennis/player1 sport/tennis/player1/ranking sport/tennis/player1/score/wimbledon | |
2 | sport/# | legal | sport sport/tennis sport/tennis/player1 sport/tennis/player1/ranking sport/tennis/player1/score/wimbledon | Multi level wildcards can match the parent directory |
3 | sport/tennis# | illegal | dissatisfaction 【 Specified separately 】 or 【 After the topic level separator 】 | |
4 | sport/tennis/#/ranking | illegal | dissatisfaction 【 Theme filter The last character specified in 】 |
1.3 Single level wildcards +
plus (‘+’ U+002B) It's a wildcard , Match only one topic level .
- Where it is used , it Must occupy the entire level of the filter
- Multiple levels in the topic filter use , And can be used with multi-level wildcards
give an example :- List of topics
- sport/tennis/player1
- sport/tennis/player1/ranking
- sport/tennis/player1/score/wimbledon
- List of topics
Serial number | Example | Legal status | Adaptive theme | remarks |
---|---|---|---|---|
1 | sport/tennis/+ | legal | sport/tennis/player1 | |
2 | sport/+ | legal | sport/ sport/tennis | Single level wildcards can only match topics of the same level , Unmatched sub themes , Nor can it match the parent theme |
3 | + | legal | sport | Single level wildcards can only match topics of the same level |
4 | +/tennis/# | legal | sport/tennis/player1 sport/tennis/player1/ranking sport/tennis/player1/score/wimbledon | |
5 | sport+ | illegal | dissatisfaction 【 Must occupy the entire level of the filter 】 |
1.4 $ The special theme at the beginning
- Multi level wildcards # And single level wildcards + Cannot match to $ The special theme at the beginning ;
- Special topics at the beginning are often used for special control purposes , for example Special topics at the beginning are often used for special control purposes , for example Special topics at the beginning are often used for special control purposes , for example SYS/, The client cannot be defined with $ The subject at the beginning
- If the client needs to subscribe The subject at the beginning , Need a separate subscription The subject at the beginning , Need a separate subscription The subject at the beginning , Need a separate subscription The theme , Usage is as follows :
- for example The name of the topic is : The name of the topic is : The name of the topic is :SYS/monitor/Clients, Then the client subscription topic filter can be set to : $SYS/monitor/+ or $SYS/monitor/#
- The client wants to receive from $SYS/ Start with a theme that doesn't start with $ The message of the beginning topic , It must also subscribe to “#” and “$SYS/#”
1.5 Subject grammar
- All topic names and topic filters must be at least one character long [MQTT-4.7.3-1], Subject rating identifier ’/' Also accounted for 1 Bytes
- Topic name and topic filter Case sensitive
- Topic names and topic filters can Include spaces character
- Lead or follow “/” Create different topic names or topic filters
- topic and /topic、topic and topic/ Neither pair has the same subject name
- Contains only “/” The subject name or subject filter of the character is valid
- Topic names and topic filters must not contain empty characters (Unicode U+0000) [ Unicode ] [MQTT-4.7.3-2]
- The topic name and topic filter are UTF-8 Encoded string , Their code must not exceed 65535 byte [MQTT-4.7.3-3]. See the first 1.5.3 section
2. Error handling
Unless otherwise stated , If the server or client encounters Agreement violations , It must close the network connection it receives the control packet that causes the protocol violation [MQTT-4.8.0-1].
Client or server implementations may encounter problems that prevent successful processing MQTT Transient error of packet ( For example, if the internal buffer is full ).
If the client or server is Process inbound control packets Transient error encountered while , It must close the network connection that receives the control packet [MQTT-4.8.0-2]. If the server detects a transient error , It should not disconnect or have any other impact on its interaction with any other client
《MQTT Quick start series 》 Fast navigation :
- 【MQTT From getting started to improving series | 01】 from 0 To 1 Quickly build MQTT Test environment
- 【MQTT From getting started to improving series | 02】MQTT3.1.1TLS The encrypted
- 【MQTT From getting started to improving series | 03】 One article mastery MQTT3.1.1 Agreement framework
- 【MQTT From getting started to improving series | 04】MQTT Application Protocol CONNECT
- 【MQTT From getting started to improving series | 05】MQTT3.1.1 And PUBLISH Publish workflow
- 【MQTT From getting started to improving series | 06】MQTT3.1.1 And SUBSCRIBE Subscription workflow
- 【MQTT From getting started to improving series | 07】MQTT3.1.1 Link keep alive and disconnect
Write at the end :
- Blog profile : focus AIoT field , Chasing the pulse of the future era , Record the technological growth on the way !
- Column Introduction : from 0 To 1 master MQTT Distributed protocol .
- Face the crowd : Zero basic programming enthusiast
- Column plan : Next, we will gradually publish a series of blog posts into artificial intelligence , Coming soon
- Python Zero foundation quick start series
- Quick start Python Data Science Series
- Artificial intelligence development environment building series
- Machine learning series
- Object detection quick start series
- Automatic driving object detection series
- …
边栏推荐
- Hey, I haven't been a project manager
- I2C client driver
- 漏洞扫码--需要整改的
- Wechat vaccine appointment applet graduation design of applet completion work (8) graduation design thesis template
- 專注跨境支付一體化服務 iPayLinks榮獲《財資》(The Asset)3A亞洲獎!
- 2022山东视力防控大会,中国护眼产品展,济南近视矫正设备展
- One Oracle statement to update or add
- Is there any risk in opening a mobile stock account? Is it safe?
- 【JS】标签页切换
- Wechat vaccine appointment applet graduation project of applet completion work (4) opening report
猜你喜欢
Wechat vaccine appointment applet graduation project of applet completion work (4) opening report
EasyGBS平台设置小技巧:如何隐藏平台web页面不被访问?
DTOs' 3D engine will replace the game engine monster and realize localization
-Solid modeling-
Database constraint & MySQL advanced query
CentOS 7上集群化部署Apache Druid 0.22实时分析数据库
C | | structure consortium enumeration type
未来旅游新方式,VR云游足不出户拥抱诗和远方
[JS] event communication
Signal integrity (SI) power integrity (PI) learning notes (XXIX) power distribution network (I)
随机推荐
Shape and boundary-aware multi-branch model for semi-supervised medical image segmentation
Is there any risk for the top ten securities companies to open accounts? Is it safe?
模仿vtk的Widget控件,制作画矩形的控件
Shape and boundary-aware multi-branch model for semi-supervised medical image segmentation
Blueprism tool menu bar user rights function description -rpa Chapter 2
如果没有选中任何线型, CAcUiLineTypeComboBox 崩溃的原因
In depth analysis: how chain 2+1 mode plays with investment attraction and drainage
[wechat applet] switch switch selector (81/100)
To test / development programmers: programmers who love life, don't work overtime, and are forced
專注跨境支付一體化服務 iPayLinks榮獲《財資》(The Asset)3A亞洲獎!
L'ipaylinks, un service d'intégration des paiements transfrontaliers, a remporté le prix 3A Asia de l'actif!
Training of head and neck segmentation networks with shape prior on small datasets
Vtk9.0.1+qt5.13 manually create four windows (mpr+3d)
CAD2014 X64 调试arx
Amazon cloud technology training and Certification Course in August is wonderful and can't be missed!
Characteristics of let keyword
What is super app? Applet has four features, you know?
How can traditional retail enterprises promote consumption cycle and share purchase mode to enable the development of physical enterprises?
【JS】标签页切换
deadlock