环境
- EMQX 版本:4.3.8
- 操作系统版本:centOS7
-php版本:7.4.3
-php-mqtt/client版本:1.8.1
-MQTTX版本:1.9.8
重现此问题的步骤
- 本身是使用php-mqtt来进行数据发送。在发送数据时已经就确认了当数据长度过长导致使用web_hook的 ```
web.hook.rule.message.publish.1 = {“action”: “on_message_publish”, “topic”: “a/b/c”}
配置文件:
##====================================================================
## WebHook
##====================================================================
## Webhook URL
##
## Value: String
web.hook.url = http://127.0.0.1:81/interface/public/index.php
## HTTP Headers
##
## Example:
## 1. web.hook.headers.content-type = application/json
## 2. web.hook.headers.accept = *
##
## Value: String
web.hook.headers.content-type = application/json
## The encoding format of the payload field in the HTTP body
## The payload field only appears in the on_message_publish and on_message_delivered actions
##
## Value: plain | base64 | base62
web.hook.body.encoding_of_payload_field = plain
##--------------------------------------------------------------------
## PEM format file of CA's
##
## Value: File
## web.hook.ssl.cacertfile = <PEM format file of CA's>
## Certificate file to use, PEM format assumed
##
## Value: File
## web.hook.ssl.certfile = <Certificate file to use>
## Private key file to use, PEM format assumed
##
## Value: File
## web.hook.ssl.keyfile = <Private key file to use>
## Turn on peer certificate verification
##
## Value: true | false
## web.hook.ssl.verify = false
## If not specified, the server's names returned in server's certificate is validated against
## what's provided `web.hook.url` config's host part.
## Setting to 'disable' will make EMQ X ignore unmatched server names.
## If set with a host name, the server's names returned in server's certificate is validated
## against this value.
##
## Value: String | disable
## web.hook.ssl.server_name_indication = disable
## Connection process pool size
##
## Value: Number
web.hook.pool_size = 32
## Whether to enable HTTP Pipelining
##
## See: https://en.wikipedia.org/wiki/HTTP_pipelining
web.hook.enable_pipelining = true
##--------------------------------------------------------------------
## Hook Rules
## These configuration items represent a list of events should be forwarded
##
## Format:
## web.hook.rule.<HookName>.<No> = <Spec>
#web.hook.rule.client.connect.1 = {"action": "on_client_connect"}
#web.hook.rule.client.connack.1 = {"action": "on_client_connack"}
#web.hook.rule.client.connected.1 = {"action": "on_client_connected"}
#web.hook.rule.client.disconnected.1 = {"action": "on_client_disconnected"}
#web.hook.rule.client.subscribe.1 = {"action": "on_client_subscribe"}
#web.hook.rule.client.unsubscribe.1 = {"action": "on_client_unsubscribe"}
#web.hook.rule.session.subscribed.1 = {"action": "on_session_subscribed"}
#web.hook.rule.session.unsubscribed.1 = {"action": "on_session_unsubscribed"}
#web.hook.rule.session.terminated.1 = {"action": "on_session_terminated"}
web.hook.rule.message.publish.1 = {"action": "on_message_publish"}
#web.hook.rule.message.delivered.1 = {"action": "on_message_delivered"}
#web.hook.rule.message.acked.1 = {"action": "on_message_acked"}
这是webhook的配置文件 望大佬解答一下
就是发送的数据稍微一长就无法触发webhook中的事件,因为我是设置了接口用来保存数据到数据库,但是现在数据一长连事件都不触发了,就导致接口都没有调用
这个配置应该是没问题的。
先排除一下是不是 web server 接受到太大的数据,没有返回。那可以打开 emqx 的 debug 日志,然后发一下emqx 的日志上来看看。
这个Topic=338223020363/warming这个主题就是一个长数据,数据到达之后debug中显示将长数据拆分了然后结构也和短一点正常的不一样,红框标出来的是正常可以的 ,然后数据虽然在webhook中存储不了 但是可以针对硬件设备的赋值是可以的
可以确定日志里面的这个 500 是你的 web server 返回来的,可以在你的 web server 那里面找找异常,为什么要返回 500.