auth_on_register_m5hooks which act as an application level firewall granting or rejecting new clients.
auth_on_register_m5hooks allow your plugin to grant or reject new client connections. Moreover it lets you exert fine grained control over the configuration of the client session. The
auth_on_registerhook is specified in the Erlang behaviour auth_on_register_hook and the
auth_on_register_m5hook in the auth_on_register_m5_hook behaviour available in the vernemq_dev repo.
auth_on_register_m5hooks are part of a conditional plugin chain. For this reason we allow the hook to return different values depending on how the plugin grants or rejects this client. In case the plugin doesn't know the client it is best to return
nextas this would allow subsequent plugins in the chain to validate this client. If no plugin is able to validate the client it gets automatically rejected.
clean_session=falseor if the client had previous sessions in the cluster, this process could take a while. (As offline messages are migrated to a new node, existing sessions are disconnected). The on_client_wakeup hook is called at the point where a queue has been successfully instantiated, possible offline messages migrated, and potential duplicate sessions have been disconnected. In other words: when the client has reached a completely initialized, normal state for accepting messages. The hook is specified in the Erlang behaviour
on_client_wakeup_hookavailable in the vernemq_dev repo.
clean_session=falseor an MQTT 5.0 client with a non-zero
session_expiry_intervalcloses the connection or gets disconnected by a duplicate client. The hook is specified in the Erlang behaviour on_client_offline_hook available in the vernemq_dev repo.
clean_session=trueor an MQTT 5.0 client with the
session_expiry_intervalset to zero closes the connection or gets disconnected by a duplicate client. The hook is specified in the Erlang behaviour on_client_gone_hook available in the vernemq_dev repo.