WebHook 插件

emqx_web_hook WebHook 插件 - 图1 (opens new window) 插件可以将所有 EMQ X 的事件及消息都发送到指定的 HTTP 服务器。

配置 WebHook 插件

etc/plugins/emqx_web_hook.conf:

  1. ## 回调的 Web Server 地址
  2. web.hook.api.url = http://127.0.0.1:8080
  3. ## 编码 Payload 字段
  4. ## 枚举值: undefined | base64 | base62
  5. ## 默认值: undefined (不进行编码)
  6. ## web.hook.encode_payload = base64
  7. ## 消息、事件配置
  8. web.hook.rule.client.connected.1 = {"action": "on_client_connected"}
  9. web.hook.rule.client.disconnected.1 = {"action": "on_client_disconnected"}
  10. web.hook.rule.client.subscribe.1 = {"action": "on_client_subscribe"}
  11. web.hook.rule.client.unsubscribe.1 = {"action": "on_client_unsubscribe"}
  12. web.hook.rule.session.created.1 = {"action": "on_session_created"}
  13. web.hook.rule.session.subscribed.1 = {"action": "on_session_subscribed"}
  14. web.hook.rule.session.unsubscribed.1 = {"action": "on_session_unsubscribed"}
  15. web.hook.rule.session.terminated.1 = {"action": "on_session_terminated"}
  16. web.hook.rule.message.publish.1 = {"action": "on_message_publish"}
  17. web.hook.rule.message.deliver.1 = {"action": "on_message_deliver"}
  18. web.hook.rule.message.acked.1 = {"action": "on_message_acked"}