The Acl.config file defines the permissions that can be subscribed to $sys topics .
{Allow, {user, ' dashboard '}, subscribe, ["$SYS/#"]}. {Allow, {ipaddr, ' 127.0.0.1 '}, PubSub, ["$SYS/#", "#"]}.%%%{deny, all, subscribe, ["$SYS/#", {eq, "#"}]}. {Allow, all}.
The third line of the Acl.config file is by default preventing clients from subscribing to $sys/#主题. We'll comment it out. Open a client and subscribe to the $sys/#主题 with the following message:
Module (emqttd_broker), which will publish messages per second, subject keywords are uptime and datetime.
Module (emqttd_stats), which publish messages every 60 seconds, sends out the information mqtt_stats the ETS table.
Module (emqttd_metrics), which is the same principle.
eg
$SYS/brokers/[email protected]/uptime:qos=0
$SYS/brokers/[email protected]/sysdescr:qos=0
Open the file Vm.args and modify the node name to:
#-name [email protected]-name [email protected]
eg
$SYS/brokers/[email protected]/uptime:qos=0
$SYS/brokers/[email protected]/sysdescr:qos=0
Topics for subscribing to a client's top-down line
The subject of a specific ClientID method for a particular node is:
$SYS/brokers/(node)/clients/(clientId)/connected$sys/brokers/[email protected]/clients/861694030142478/ Connected$sys/brokers/[email protected]/clients/861694030142478/disconnected
The theme of the wildcard method is:
$SYS/brokers/+/clients/+/connected$sys/brokers/+/clients/+/disconnected$sys/brokers/+/clients/#
For security reasons, we modified the Acl.config file to:
Allow clients to subscribe to the "$SYS/brokers/+/clients/#" topic, but not subscribe to the "$SYS/#" topic.
{Allow, {user, ' dashboard '}, subscribe, ["$SYS/#"]}. {Allow, {ipaddr, "127.0.0.1"}, PubSub, ["$SYS/#", "#"]}. {Allow, all, subscribe, ["$SYS/brokers/+/clients/#"]}. {Deny, all, subscribe, ["$SYS/#", {eq, "#"}]}. {Allow, all}.
EMQ Learn---Subscribe to the $sys topic to capture the client's downline messages