auth_on_register
) is called, the VerneMQ Webhooks plugin dispatches a HTTP post request to the registered endpoint. The HTTP post request contains a HTTP header like vernemq-hook: auth_on_register
and a JSON encoded payload. The endpoint then responds with code 200 on success and with a JSON encoded payload informing the VerneMQ Webhooks plugin which action to take (if any).no_payload
config:vernemq.conf
file:vmq_webhooks.pool_max_connections
to a different value. Similarly the vmq_webhooks.pool_timeout
configuration (value is in milliseconds) can be set to control how long an unused connection should stay in the connection pool before being closed and removed. The default value is 60000 (60 seconds).auth_on_register
, auth_on_publish
and auth_on_subscribe
hooks.auth_on_publish
where the payload is omitted.cache-control: max-age=AgeInSeconds
in the response headers to one of the mentioned hooks. If the call was successful (authentication granted), the request will be cached together with any modifiers, except for the payload
modifier in the auth_on_publish
hook.POST
. All hooks need to be answered with the HTTP code 200
to be considered successful. Any hook called that does not return the 200
code will be logged as an error as will any hook with an unparseable payload.vernemq-hook
which contains the name of the hook in question.vernemq-hook: auth_on_register
retry_interval
is in milli-seconds. It is possible to override many more settings, see the Session Lifecycle for more information.vernemq-hook: auth_on_subscribe
qos
with value 128
which means it was either not possible or the client was not allowed to subscribe to that specific question.vernemq-hook: auth_on_publish
vernemq-hook: on_register
{}
.vernemq-hook: on_publish
{}
.vernemq-hook: on_subscribe
{}
.vernemq-hook: on_unsubscribe
vernemq-hook: on_deliver
vernemq-hook: on_offline_message
{}
.vernemq-hook: on_client_wakeup
{}
.vernemq-hook: on_client_offline
{}
.vernemq-hook: on_client_gone
{}
.vernemq-hook: auth_on_register_m5
retry_interval
is in milli-seconds. It is possible to override many more settings, see the Session Lifecycle for more information.vernemq-hook: on_auth_m5
vernemq-hook: auth_on_subscribe_m5
forbidden/topic
has been rejected with the qos
value of 135 (Not authorized).vernemq-hook: auth_on_publish_m5
vernemq-hook: on_register_m5
{}
.vernemq-hook: on_publish_m5
{}
.vernemq-hook: on_subscribe_m5
128
(Unspecified error) means the subscription was rejected.{}
.vernemq-hook: on_unsubscribe_m5
vernemq-hook: on_deliver_m5
web
and json
modules and implements handlers for three different hooks: auth_on_register
, auth_on_publish
and auth_on_subscribe
.auth_on_register
hook only restricts access only to the user with username joe
and password secret
. The auth_on_subscribe
and auth_on_publish
hooks allow any subscription or publish to continue as is. These last two hooks are needed as the default policy is deny
.vernemq.conf
file: