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_registerand 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).
vmq_webhooks.pool_max_connectionsto a different value. Similarly the
vmq_webhooks.pool_timeoutconfiguration (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_publishwhere the payload is omitted.
cache-control: max-age=AgeInSecondsin 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
payloadmodifier in the
POST. All hooks need to be answered with the HTTP code
200to be considered successful. Any hook called that does not return the
200code will be logged as an error as will any hook with an unparseable payload.
vernemq-hookwhich contains the name of the hook in question.
128which means it was either not possible or the client was not allowed to subscribe to that specific question.
forbidden/topichas been rejected with the
qosvalue of 135 (Not authorized).
128(Unspecified error) means the subscription was rejected.
jsonmodules and implements handlers for three different hooks:
auth_on_registerhook only restricts access only to the user with username
auth_on_publishhooks allow any subscription or publish to continue as is. These last two hooks are needed as the default policy is