当前位置:网站首页>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
边栏推荐
- mTabLayout. setOnTabSelectedListener is deprecated
- 日本版arXiv凉得一批:2个多月了,才收到37篇论文
- How about the one-stop machine learning opening platform mlflow?
- SAP Field Service Management 和微信集成的案例分享和实现介绍
- Wechat web development tool tutorial, the company develops Web
- 2022年6月中国数据库排行榜:TiDB卷土重来摘桂冠,达梦蛰伏五月夺探花
- Software project management 6.10 Cost budget
- VDO-SLAM: A Visual Dynamic Object-aware SLAM System 论文阅读
- [golang] when creating a structure with configuration parameters, how should the optional parameters be transferred?
- 【NLP】NLP全路径学习推荐
猜你喜欢

Google proposed the super pre training model coca, and the accuracy of fine-tuning top-1 on Imagenet reached 91%! SOTA on multiple downstream tasks!

The Japanese version of arXiv is a cool batch: only 37 papers have been received after more than 2 months

Alibaba cloud ECS server builds MySQL database

Unity3d uses URP rendering pipeline to realize ar shadow (shadow casting and transparent ground)
![[spark] (task8) pipeline channel establishment in sparkml](/img/9c/69c6d0cb27906eb895cfc7e4f45f96.png)
[spark] (task8) pipeline channel establishment in sparkml

Software project management 6.10 Cost budget

IQR箱线图

Wechat web development tool tutorial, the company develops Web

How about the one-stop machine learning opening platform mlflow?

Introduction to assembly language - Summary
随机推荐
学籍管理系统
If the files and graphics are lost, it means that you don't need the office developed by yourself
如何才能把团队给带解散。。。
Cvpr2022|aconvnetforthe2020s & how to design neural network Summary
eKuiper Newsletter 2022-05|protobuf 编解码支持、可视化拖拽编写规则
[flinlk] dynamic Kerberos authentication in Flink pit
12、 Process address space (PMAP; vdso; MMAP)
Today, a couple won the largest e-commerce IPO in Hong Kong
OFFICE技术讲座:标点符号-英文-大全
Use unique to quickly remove duplicate elements
client-go gin的简单整合六-list-watch二(关于Rs与Pod以及Deployment的完善)
Code free may event Microsoft low code matrix update; Multiple industry reports released
百度程序员删库被判9个月,手机号一键解绑功能发布,推特再向马斯克妥协,今日更多大新闻在此...
Vdo-slam source code reading notes [1] dynamic obj part in track()
Mobile phone manufacturers "go back to their ancestors", only apple said no
Leetcode 96. Different binary search trees
Colmap source code reading notes [1] threading cc
Some words from ShareIt group
The ability to register user names and passwords with the database
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