Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (9 sloc) 2.16 KB

Subscribe Flow

In this section the subscription flow is described. VerneMQ provides several hooks to intercept the subscription flow. The most important ones are the auth_on_subscribe and auth_on_subscribe_m5 hooks which act as an application level firewall granting or rejecting subscribe requests.

auth_on_subscribe and auth_on_subscribe_m5

The auth_on_subscribe and auth_on_subscribe_m5 hooks allow your plugin to grant or reject subscribe requests sent by a client. They also makes it possible to rewrite the subscribe topic and qos. The auth_on_subscribe hook is specified in the Erlang behaviour auth_on_subscribe_hook and the auth_on_subscribe hook in the auth_on_subscribe_m5_hook behaviour available in the vernemq_dev repo.

on_subscribe and on_subscribe_m5

The on_subscribe and on_subscribe_m5 hooks allow your plugin to get informed about an authorized subscribe request. The on_subscribe hook is specified in the Erlang behaviour on_subscribe_hook and the on_subscribe_m5 hook in the on_subscribe_m5_hook behaviour available in the vernemq_dev repo.

on_unsubscribe and on_unsubscribe_m5

The on_unsubscribe and on_unsubscribe_m5 hooks allow your plugin to get informed about an unsubscribe request. They also allow you to rewrite the unsubscribe topic if required. The on_subscribe hook is specified in the Erlang behaviour on_unsubscribe_hook and the on_unsubscribe_m5 hook in the on_unsubscribe_m5_hook behaviour available in the vernemq_dev repo.