diff --git a/apps/emqx_web_hook/src/emqx_web_hook.erl b/apps/emqx_web_hook/src/emqx_web_hook.erl index 708c86f23..483f197ee 100644 --- a/apps/emqx_web_hook/src/emqx_web_hook.erl +++ b/apps/emqx_web_hook/src/emqx_web_hook.erl @@ -92,7 +92,8 @@ on_client_connect(ConnInfo = #{clientid := ClientId, username := Username, peern , username => maybe(Username) , ipaddress => iolist_to_binary(ntoa(Peerhost)) }, - send_http_request(ClientId, add_optional_conn_fields(Params, ConnInfo)). + OptFields = [keepalive, proto_ver], + send_http_request(ClientId, add_optional_conn_fields(Params, OptFields, ConnInfo)). %%-------------------------------------------------------------------- %% Client connack @@ -107,7 +108,8 @@ on_client_connack(ConnInfo = #{clientid := ClientId, username := Username, peern , ipaddress => iolist_to_binary(ntoa(Peerhost)) , conn_ack => Rc }, - send_http_request(ClientId, add_optional_conn_fields(Params, ConnInfo)). + OptFields = [keepalive, proto_ver, connected_at], + send_http_request(ClientId, add_optional_conn_fields(Params, OptFields, ConnInfo)). %%-------------------------------------------------------------------- %% Client connected @@ -121,7 +123,8 @@ on_client_connected(#{clientid := ClientId, username := Username, peerhost := Pe , username => maybe(Username) , ipaddress => iolist_to_binary(ntoa(Peerhost)) }, - send_http_request(ClientId, add_optional_conn_fields(Params, ConnInfo)). + OptFields = [keepalive, proto_ver, connected_at], + send_http_request(ClientId, add_optional_conn_fields(Params, OptFields, ConnInfo)). %%-------------------------------------------------------------------- %% Client disconnected @@ -380,5 +383,5 @@ stringfy(Term) -> maybe(undefined) -> null; maybe(Str) -> Str. -add_optional_conn_fields(Fields, ConnInfo) -> - maps:merge(Fields, maps:with([keepalive, proto_ver, connected_at], ConnInfo)). +add_optional_conn_fields(Params, OptFields, ConnInfo) -> + maps:merge(Params, maps:with(OptFields, ConnInfo)). diff --git a/changes/v4.4.19-en.md b/changes/v4.4.19-en.md index 93f604213..748291242 100644 --- a/changes/v4.4.19-en.md +++ b/changes/v4.4.19-en.md @@ -33,3 +33,7 @@ Prior to the fix, the `date` variable exported by `FOREACH` could not be accessed in the `DO` clause of the above SQL, resulting in the following output for the SQL statement: `[{"elem": "a","date": "undefined"}]`. After the fix, the output of the SQL statement is: `[{"elem": "a","date": "2023-05-06"}]` + +- Fixed an issue where the WebHook plugin failed to execute the `on_client_connack` hook [#10710](https://github.com/emqx/emqx/pull/10710). + + See https://github.com/emqx/emqx/issues/10628 for more details. diff --git a/changes/v4.4.19-zh.md b/changes/v4.4.19-zh.md index dc5a77fac..a17986b71 100644 --- a/changes/v4.4.19-zh.md +++ b/changes/v4.4.19-zh.md @@ -33,3 +33,7 @@ 修复前,以上 SQL 语句中 `FOREACH` 导出的 `date` 变量无法在 `DO` 子句中访问,导致以上 SQL 的输出为: `[{"elem": "a","date": "undefined"}]`。 修复后,SQL 的输出为:`[{"elem": "a","date": "2023-05-06"}]` + +- 修复 WebHook 插件执行 `on_client_connack` 钩子失败的问题 [#10710](https://github.com/emqx/emqx/pull/10710)。 + + 详见 https://github.com/emqx/emqx/issues/10628