MQTT Client Connection Status

Hi,

Is there any way to check if any client connect/disconnect so on server side status update on MQTT?
If possible, please guide me the step to do it.

Hi, you should subscribe to:

$events/client_connected
$events/client_disconnected

for full list see here:

Hi Vito,

Thank you for reply.

I already tried this but no connection events receive.
Is there any other way to do this?

Try to create a rule (data integration), in order to move packets to a different recipient (sql server, kafka…). It will work.
Actually, It doesn’t work, if you try to subscribe with a client tool (e.g. MQTTX) to those topic.

I have backend server on NodeJS and I connected to EMQX over MQTT and subscribe to these topics.
Also I’m using MongoDB.

Actually, directly subscribing to those topics doesn’t work (at least for me). I should use a data integration rule (kafka one) in order to receive those packets

But I need realtime update to send frontend applications for update connection status of device.

Yes, we have the same requirement. Actually, adding one more step to the pipeline (Kafka for example) is not a big problem. Believe me, it’s matter of few milliseconds