Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

监听MQTT客户端状态(在线、离线) #8

Closed
atlqh opened this issue Jan 28, 2021 · 1 comment
Closed

监听MQTT客户端状态(在线、离线) #8

atlqh opened this issue Jan 28, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@atlqh
Copy link

atlqh commented Jan 28, 2021

一、业务场景
监测MQTT客户端状态(在线、离线)。

其实这个在MQTT协议中已经给出系统主题,MQTT服务端可以知道客户端的任何情况,比如:什么时候上线和下线。

二、解决方案
$SYS/brokers/${node}/clients/${clientid}/connected:上线事件。当某客户端上线时,会向该主题(Topic)发布消息

$SYS/brokers/${node}/clients/${clientid}/disconnected:掉线事件。当某客户端掉线时,会向该主题(Topic)发布消息

订阅两个主题比较麻烦,可以采用主题通配符模式直接订阅一个主题即可:$SYS/broker/+/client/#

@Amazingwujun
Copy link
Owner

已支持,参见 readme 中关于功能主题的介绍

@Amazingwujun Amazingwujun added the enhancement New feature or request label Feb 18, 2021
@Amazingwujun Amazingwujun self-assigned this Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants