# Online and Offline notification
EMQX online and offline system message notification function automatically sends a system topic message when the client connection is successful or the client is disconnected, and EMQX turns on the online and offline notification module by default.
# Create module
The online and offline notification module is started by default and can be started and stopped through the dashboard page.
Open EMQX Dashboard (opens new window), click the "Modules" tab on the left:
Select the online and offline notification module
There is no need to configure any parameters for the online and offline notification. After you click Add directly, the module is added.
# Online and offline message notification format
$SYS
Subject prefix: $SYS/brokers/${node}/clients/
| Topic | Description | | ------------------------ | ------------------------ ---------------- | | ${clientid}/connected | Online event. When any client goes online, EMQX will publish a message on that topic | | ${clientid}/disconnected | Offline event. When any client goes offline, EMQX will publish a message on that topic |
The Payload of the connected
event message is parsed into JSON format as follows:
{ "username": "foo", "ts": 1625572213873, "sockport": 1883, "proto_ver": 4, "proto_name": "MQTT", "keepalive": 60, "ipaddress": "127.0.0.1", "expiry_interval": 0, "connected_at": 1625572213873, "connack": 0, "clientid": "emqtt-8348fe27a87976ad4db3", "clean_start": true }
Copied!
2
3
4
5
6
7
8
9
10
11
12
13
14
The Payload of the disconnected
event message is parsed into JSON format as follows:
{ "username": "foo", "ts": 1625572213873, "sockport": 1883, "reason": "tcp_closed", "proto_ver": 4, "proto_name": "MQTT", "ipaddress": "127.0.0.1", "disconnected_at": 1625572213873, "clientid": "emqtt-8348fe27a87976ad4db3" }
Copied!
2
3
4
5
6
7
8
9
10
11