当前位置:网站首页>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 13:13:00 【EMQX】
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 .
web.hook.enable=true
## Format example
web.hook.rule.<Event>.<Number>=<Rule>
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/#"}
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": 60,
"conn_ack": "success",
"username": "undefined",
"clientid": "nanomq-6ecb0b61",
"action": "client_connack"
}
Publish( News release ):
{
"ts": 1650609267000,
"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"
}
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
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
边栏推荐
- GNN is used as the new backbone of the three major tasks of CV, with the same cost performance as CNN, Vit and MLP | Chinese Academy of Sciences & Huawei Noah open source
- Alibaba cloud ECS server builds MySQL database
- Wei Lai: "pinches" the data and "pinches" the future
- QA of some high frequency problems in oauth2 learning
- Give root password for maintenace (or press Control-D to continue): solution
- QT database application 22 file coding format recognition
- 2022 Zhejiang provincial competition
- What if the xshell evaluation period has expired? Follow the steps below to solve the problem!
- Tensorflow2.0 advanced learning - image (11)
- Program, calculate 2/1+3/2+5/3+8/5 Value of. It is required to calculate the sum of the first n items and keep 2 decimal places (starting from the second item of the sequence, the numerator of each it
猜你喜欢

用C语言创建基本的栈与队列

What if the xshell evaluation period has expired? Follow the steps below to solve the problem!

如何才能把团队给带解散。。。

3. 网页开发工具 VS Code

百度程序员删库被判9个月,手机号一键解绑功能发布,推特再向马斯克妥协,今日更多大新闻在此...

Recommended learning materials for Altium Designer

Case sharing and implementation introduction of SAP field service management and wechat integration

Simple integration of client go gin six list watch two (about the improvement of RS, pod and deployment)

Baidu programmers were sentenced to nine months for deleting the database. The one click unbinding function of the mobile phone number was released. Twitter compromised with musk again. Today, more bi

Ant financial services Yang Jun: evolution of ant data analysis platform and application of data analysis methods
随机推荐
不吐不快
MySQL数据库(26):视图 view
[Accessibility] Missing contentDescription attribute on image
Recommended learning materials for Altium Designer
Sohu employees encounter wage subsidy fraud. What is the difference between black property and gray property and how to trace the source?
Asynchronous export of Excel
The APK file does not exist on disk
OFFICE技术讲座:标点符号-英文-大全
【NLP】NLP全路径学习推荐
MySQL 服务演进
Development trend of Web Development
Count the number and average value of natural numbers whose sum of bits within 100 is 7
Colmap source code reading notes [1] threading cc
Simple integration of client go gin six list watch two (about the improvement of RS, pod and deployment)
QA of some high frequency problems in oauth2 learning
[raise bar C #] how to call the base of the interface
Example of full page sliding screen at mobile terminal (sliding the whole screen up and down) (sorting)
TIDB 初级课程体验 8 (集群的管理维护, 添加一个TIKV节点)
OFFICE技术讲座:标点符号-中文-竖排
The Japanese version of arXiv is a cool batch: only 37 papers have been received after more than 2 months