How to Find Connected MQTT Client Details

前端 未结 2 623
难免孤独
难免孤独 2020-12-08 11:24

Is there any way we can find about all the connected client details(IP & name) from another client? I know there is a topic \"$SYS/broker/clients/active\" which gives th

2条回答
  •  眼角桃花
    2020-12-08 11:57

    like Knolleary already stated this is implementation specific and not provided by MQTT itself.

    One solution could be to use the HiveMQ MQTT broker. It has a Plugin SDK, which allows you to do such customization over callbacks, meaning every time a client connects, disconnects, send a message, subscribes to a message you can execute custom code, like in your case sending an email. When writing your custom code you can access all information about the client, which has invoked the callback. So it would be easy to implement your behavior. The only thing is where do you store the email address? Is it the username?

    For more information on writing custom HiveMQ plugins see the getting started guide and the example plugin on GitHub

    (Disclosure: I'm one of the HiveMQ developers)

    Cheers, Chris

提交回复
热议问题