Skip to content

Add mqtt_connect and mqtt_disconnect hooks to mod_mqtt_session #4569

@dilshan-bhasha

Description

@dilshan-bhasha

I'm not a good erlang developer, but I have developed some custom modules for my ejabberd service. When developing a module, we need to track MQTT device connections. some times device connects but disconnects for some reason. but we cannot isolate the devices that frequently connection/disconnection happening.

Currently, ejabberd's MQTT implementation lacks event hooks for connection and disconnection events (it may be for performance optimization). Unlike XMPP which provides sm_register_connection_hook and sm_remove_connection_hook, MQTT has no equivalent mechanism for external modules to react to client lifecycle events.

This limitation prevents:

  • Real-time user/device tracking and analytics
  • Integration with external monitoring systems
  • Custom authentication/authorization workflows post-connection
  • IoT device provisioning workflows

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions