-
Notifications
You must be signed in to change notification settings - Fork 54
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
Are there any plans to support hooks such as connected, disconnected, authenticate? #355
Comments
Do you want MOP to push events to a specific topic, and then you can use pulsar or mqtt client to monitor it? |
@mattisonchao |
I think it's a good suggestion. what do you think about it ? @Technoboy- |
Hi @liweiv, this is really a good suggestion, but I'm not sure if some other MQTT implementations that support this feature? |
Ok, i will work on it. |
@Technoboy- This feature can be found in emqx. |
Do you mean this feature in emqx ? the link is : https://docs.emqx.io/en/enterprise/v4.4/advanced/hooks.html#callback-function |
I think we current do not need to support hook, because MOP just is a protocol plugin for pulsar. add hook will be too complicated But we can support system event topic to push event by json format. What do you guys think about this. If agree, i will submit a MIP. |
@Technoboy- |
make sense. |
@liweiv @liangyuanpeng @Technoboy- Ok, I will submit a MIP. |
@liweiv You can track connected status through LWT which is part of the MQTT standard for basically this exact reason. Typical implementation would be that an MQTT client sets up an LWT message which is fired by the broker when the keep alive mechanism fails signaling that the connection is likely dead. Expected behavior here is that you'd fire a message on client disconnect, similarly on graceful disconnect you'd just send a message before you disconnect. To handle connect events just publish connect events when you connect, or a more robust approach would be to have your connection status message be retained, so that you can have the client itself subscribe on it's connection topic and always send a conneced status in response to any disconnected status messages. This way if LWT fires from another broker, and you reconnected to a different broker and publish a connected message before the LWT fires, you can correct the potential race condition that occurs. So this mechanism is baked into the MQTT standard, and is a very common means to do the exact type of connection tracking you're talking about. Unfortunately LWT in MoP does not behave correctly, as it only publishes LWT events to MQTT subscribers, and LWTs currently do not reach Pulsar topics at all. I have proposed a fix for this, however it's gotten no response in several months: #943 |
Is your enhancement request related to a problem? Please describe.
Are there any plans to support hooks such as connected, disconnected, authenticate?
Describe the solution you'd like
In IoT application scenarios, we often pay attention to when the device is connected or disconnected, as well as the time and result of device authentication. Can the corresponding hook be enabled in a configurable way to convert the message to the pulsar protocol? The back-end program can monitor when the device is connected or disconnected by subscribing to the configured topic
The text was updated successfully, but these errors were encountered: