当前位置:网站首页>Nanomq newsletter 2022-05 | release of V0.8.0, new webhook extension interface and connection authentication API
Nanomq newsletter 2022-05 | release of V0.8.0, new webhook extension interface and connection authentication API
2022-06-10 16:11:00 【51CTO】
NanoMQ It is edge oriented MQTT Message engine + Multi protocol message bus . Support MQTT The protocol and ZeroMQ and Nanomsg And other common bus protocols at different edges , Integrate broker and brokerless Message schema , It is convenient to build Internet of things edge computing applications .
Community station address : https://nanomq.io/zh
GitHub Warehouse : https://github.com/emqx/nanomq
NanoMQ The project keeps a small version every month + Steady iteration speed of an important new feature ,v0.8.0 It was officially released at the end of May ( Download address : https://github.com/emqx/nanomq/releases/tag/0.8.0). This time we bring you 2 Important feature updates :Event WebHook And can work with third parties HTTP API Integrated connection authentication interface . At the same time, it also added the View topic tree structure HTTP API, Various performance optimization and defect repair are also being continuously updated .
Efficient and easy-to-use edge WebHook System
WebHook yes EMQX A function loved by the majority of open source users ,NanoMQ It has also launched the same function to facilitate the integration of users with third-party edge computing applications .
NanoMQ Of WebHook System and EMQX In line , Use the same style of configuration .Webhook The default search path for the configuration file of is /etc/nanomq_web_hook.conf, You can also start by reading the configuration file through the command line . Specific configuration items can be viewed NanoMQ Docs : https://nanomq.io/docs/zh/latest/web-hook.html# Configuration item .
Enable... In settings WebHook After function , You can configure triggering rules according to your needs , If it is necessary to match the client's online and offline events and all to ”webhook/msg/#” Messages of wildcard topics are forwarded to the corresponding HTTP API, The configuration method is as follows :
Trigger rule configuration
stay etc/nanomq_web_hook.conf Configurable trigger rules , The configuration format is as follows :
## Example
web.hook.enable=true
web.hook.url=http://127.0.0.1:8888
web.hook.headers.content-type=application/json
web.hook.body.encoding_of_payload_field=plain
web.hook.pool_size=32
web.hook.rule.client.connack.1={"action": "on_client_connack"}
web.hook.rule.client.disconnected.1={"action": "on_client_disconnected"}
web.hook.rule.message.publish.1={"action": "on_message_publish", "topic": "webhook/msg/#"}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
This setting will make NanoMQ Automatically capture and spit out the data of the client's online and offline and message publishing to the corresponding HTTP API 了 . at present HTTP An example of the requested data format is shown below :
## HTTP json Format example
Connack( The client connection success event ):
{
"proto_ver":
4,
"keepalive":
6
0,
"conn_ack":
"success",
"username":
"undefined",
"clientid":
"nanomq-6ecb0b61",
"action":
"client_connack"
}
Publish( News release ):
{
"ts":
1
6
5
0
6
0
9
2
6
7
0
0
0,
"topic":
"webhook/msg/123",
"retain": false,
"qos":
0,
"action":
"message_publish",
"from_username":
"undefined",
"from_client_id":
"nanomq-6ecb0b61",
"payload":
"hello"
}
Disconnect( Client connection disconnection event ):
{
"reason":
"normal",
"username":
"undefined",
"clientid":
"nanomq-6ecb0b61",
"action":
"client_disconnected"
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
at present NanoMQ Of WebHook The system supports the following events :
name | explain | Execution opportunity |
client.connack | MQTT Client connection successful | When the server is ready to send the connection response message |
client.disconnected | MQTT Client disconnected | When the client connection layer is ready to close |
message.publish | MQTT News release | The server is publishing ( route ) Before news |
If you need more information, please go to NanoMQ Project Github page Submit function application Issue, We will arrange to add... As soon as possible .
It's important to note that ,NanoMQ Of WebHook The function is fully asynchronous operation , All matching event messages will pass through efficient internal IPC The channel enters a separate proprietary thread for processing , And Broker Functional isolation , It will not block the normal message flow in the original server , Very efficient and reliable .

About WebHook Specific configuration information and methods , And how to tune it. Please look forward to the next NanoMQ Series of tutorial articles .
HTTP Connection authentication API
HTTP Connection authentication is another common integration feature , It can easily integrate with the third-party authentication server to complete the connection request verification of the client . Another common open source project Mosquitto The plug-ins of the same type have been abandoned and are no longer maintained ,NanoMQ This function fills this gap , And it also maintains EMQX Same function and configuration style , Convenient for users .
Authentication rule configuration
Authentication HTTP API The configuration file reading method of the interface is the same as NanoMQ Other configuration files are the same . The internal configuration items include :
## Open or not HTTP Auth plug-in unit
## Value: true | false
auth.http.enable = true
## Auth Requested target HTTP URL
auth.http.auth_req.url = http://127.0.0.1:80/mqtt/auth
## HTTP Auth Request Request mode
## Value: post | get
auth.http.auth_req.method = post
## HTTP Request Headers for Auth Request
auth.http.auth_req.headers.content_type = application/x-www-form-urlencoded
## Parameters used to construct the request body or query string parameters
auth.http.auth_req.params = clientid=%c,username=%u,password=%P
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
When the configuration is complete ,NanoMQ The client will be configured according to the request format Connect The package information request corresponds to HTTP URL. And judge whether to allow the client to connect successfully according to the return code (Code 200 It means success ). Please refer to the official website configuration document for more detailed configuration methods https://nanomq.io/docs/en/latest/config-description.html#parameter-description.
Other function optimization and Bug Repair
Besides ,NanoMQ 0.8.0 There are also the following updates and optimizations :
- Correct the timestamp in the client's online and offline time messages timestamp Field is UNIX Standard timestamps , Before, it was the start timer .
- Revised NanoMQ How to use command line tools , Removed the default must use “start/stop” The limitation of .
- increase ZeroMQ Proxy message gateway documentation .
- Fixed the lock contention problem when the bridge connection is frequently closed by the remote end .
- Fixed the backlog caused by a large number of messages published by the client ,Sub The data contention problem caused by the sudden port of the client .
- The content of the last wish message will no longer be modified by default UTF-8 Check , Only when requested by the client .
- Fixed a problem using Retain As Published If the message attribute is empty, it will cause a crash .
Coming soon
NanoMQ The rule engine will be officially released next month , As well as the inclusion of new databases as full persistence options for edge data . This function is currently in Demo Stage , In the latest main branch, you can use . Users can compile, install and use by themselves , Welcome to have some fresh food : https://github.com/emqx/nanomq/ .
NanoSDK It will be released next month MQTT over QUIC Of RC edition , This is the industry's first based on C Full language support MQTT 3.1.1 and QUIC Functional MQTT SDK, Coming soon .
Copyright notice : This paper is about EMQ original , Reprint please indicate the source .
Link to the original text : https://www.emqx.com/zh/blog/nanomq-newsletter-202205
边栏推荐
- Cube 技术解读 | Cube 渲染设计的前世今生
- 智能电网终极Buff | 广和通模组贯穿“发、输、变、配、用”全环节
- [object].
- Unified certification center oauth2 certification pit
- SVM and ANN of OpenCV neural network library_ Use of MLP
- Live broadcast preview | deconstruct OLAP! The new multidimensional analysis architecture paradigm is fully open! Apache Doris will bring five big issues!
- 2D human pose estimation for pose estimation - simdr: is 2D Heatmap representation even necessity for human pose estimation?
- 【第七节 函数的作用】
- Distribution aware coordinate representation for human pose estimation
- MapReduce案例之排序
猜你喜欢

Scope and closure

【历史上的今天】6 月 10 日:Apple II 问世;微软收购 GECAD;发明“软件工程”一词的科技先驱出生

顺应医改,积极布局——集采背景下的高值医用耗材发展洞察2022

Aperçu en direct | déconstruire OLAP! Le nouveau paradigme de l'architecture d'analyse multidimensionnelle est entièrement ouvert! Apache Doris va apporter cinq gros problèmes!

Code implementation of sorting and serializing cases in MapReduce

This and object prototypes

Recommend an easy-to-use designer navigation website

姿态估计之2D人体姿态估计 - Numerical Coordinate Regression with Convolutional Neural Networks(DSNT)

Detailed explanation of RGB color space, hue, saturation, brightness and HSV color space

排序与分页
随机推荐
uniapp中常用到的方法(部分) - 时间戳问题及富文本解析图片问题
Google X开源抓取机械臂,无需人工标注就能一眼找到目标零件[转]
2D human posture estimation for posture estimation - associated embedding: end to end learning for joint detection and grouping
剑指 Offer 06. 从尾到头打印链表
2D human pose estimation with residual log likelihood estimation (RLE) [link only]
json. Load (s) and json dump(s)
Common sense: the number of neurons in the brain of mice is about 70million and that of humans is about 86billion
Jerry's long press reset and high level reset [chapter]
Unified certification center oauth2 certification pit
【第六节 函数】
MapReduce案例之排序
Apple mailbox configures QQ mailbox, 163 mailbox, edu mailbox, Gmail mailbox, and obtains Gmail calendar
How does the wireless communication module help the intelligent UAV build the "Internet of things in the air"?
Join operation cases in the map phase of MapReduce
Méthodes couramment utilisées dans uniapp - TIMESTAMP et Rich Text Analysis picture
Methods commonly used in uniapp (part) - timestamp problem and rich text parsing image problem
Interpretation of cube technology | past and present life of cube Rendering Design
Scope and closure
Jerry's interface for obtaining ble broadcast package and profile data [chapter]
Click to unlock "keyword" of guanghetong 5g module