Skip to content

Are there any plans to support hooks such as connected, disconnected, authenticate? #355

Description

@liweiv

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

Activity

  1. mattisonchao commented on Dec 25, 2021

    @mattisonchao
    Member

    @liweiv

    Do you want MOP to push events to a specific topic, and then you can use pulsar or mqtt client to monitor it?

  2. liweiv commented on Dec 25, 2021

    @liweiv
    Author

    @mattisonchao
    Yes, I want to use pulsar protocol to monitor it. This is very useful for backend server program to handle some business logical.

  3. mattisonchao commented on Dec 25, 2021

    @mattisonchao
    Member

    @liweiv

    I think it's a good suggestion. what do you think about it ? @Technoboy-

  4. Technoboy- commented on Dec 27, 2021

    @Technoboy-
    Contributor

    Hi @liweiv, this is really a good suggestion, but I'm not sure if some other MQTT implementations that support this feature?
    We can check this feature first and then make a MIP to discuss. @mattisonchao

  5. mattisonchao commented on Dec 27, 2021

    @mattisonchao
    Member

    @Technoboy-

    Ok, i will work on it.

  6. liweiv commented on Dec 27, 2021

    @liweiv
    Author

    @Technoboy- This feature can be found in emqx.

  7. mattisonchao commented on Dec 28, 2021

    @mattisonchao
    Member
  8. mattisonchao commented on Dec 28, 2021

    @mattisonchao
    Member

    @Technoboy- @liweiv

    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.

  9. liweiv commented on Dec 28, 2021

    @liweiv
    Author

    @Technoboy-
    Ok, I think the way of event topic can solve problems。

  10. liangyuanpeng commented on Dec 28, 2021

    @liangyuanpeng
    Contributor

    But we can support system event topic to push event by json format.

    make sense.

  11. mattisonchao commented on Dec 28, 2021

    @mattisonchao
    Member

    @liweiv @liangyuanpeng @Technoboy-

    Ok, I will submit a MIP.

  12. self-assigned this
    on Jan 5, 2022
  13. tsturzl commented on Dec 1, 2023

    @tsturzl
    Contributor

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions