应该是配置了客户端认证的原因(吗),可以直接拒绝掉吗
你看看 emqx 的 debug 日志,按道理认证失败客户端不应该重连。
emqx的debug日志:
2023-12-15 19:05:32 2023-12-15T11:05:32.605674+00:00 [debug] event=send_data_succeeded socket="#Port<0.1970>"
2023-12-15 19:05:32 2023-12-15T11:05:32.605890+00:00 [debug] message=ping event=transmission_succeeded driver=tcp socket="#Port<0.1970>"
2023-12-15 19:05:32 2023-12-15T11:05:32.605814+00:00 [debug] event=ping_received driver=tcp socket="#Port<0.1971>" peer="123.456.7.8:49986" action=ignore
2023-12-15 19:05:42 2023-12-15T11:05:42.331950+00:00 [debug] msg: raw_bin_received, mfa: emqx_connection:when_bytes_in/3(778), peername: 123.456.7.8:40104, clientid: mqtt_v5-server, bin: C000, size: 2, type: hex
2023-12-15 19:05:42 2023-12-15T11:05:42.332192+00:00 [debug] msg: mqtt_packet_received, mfa: emqx_connection:handle_msg/2(575), peername: 123.456.7.8:40104, clientid: mqtt_v5-server, packet: PINGREQ(Q0, R0, D0), tag: MQTT
2023-12-15 19:05:42 2023-12-15T11:05:42.332320+00:00 [debug] msg: mqtt_packet_sent, mfa: emqx_connection:serialize_and_inc_stats_fun/1(877), peername: 123.456.7.8:40104, clientid: mqtt_v5-server, packet: PINGRESP(Q0, R0, D0), tag: MQTT
2023-12-15 19:05:44 2023-12-15T11:05:44.004279+00:00 [debug] msg: emqx_connection_terminated, mfa: emqx_connection:terminate/2(668), peername: 123.456.7.8:59252, reason: {shutdown,tcp_closed}, tag: SOCKET
2023-12-15 19:05:44 2023-12-15T11:05:44.004508+00:00 [info] msg: terminate, mfa: emqx_connection:terminate/2(673), peername: 123.456.7.8:59252, reason: {shutdown,tcp_closed}
2023-12-15 19:05:58 2023-12-15T11:05:58.022825+00:00 [debug] msg: emqx_connection_terminated, mfa: emqx_connection:terminate/2(668), peername: 123.456.7.8:35088, reason: {shutdown,tcp_closed}, tag: SOCKET
2023-12-15 19:05:58 2023-12-15T11:05:58.023084+00:00 [info] msg: terminate, mfa: emqx_connection:terminate/2(673), peername: 123.456.7.8:35088, reason: {shutdown,tcp_closed}
2023-12-15 19:06:12 2023-12-15T11:06:12.044690+00:00 [debug] msg: emqx_connection_terminated, mfa: emqx_connection:terminate/2(668), peername: 123.456.7.8:45826, reason: {shutdown,tcp_closed}, tag: SOCKET
2023-12-15 19:06:12 2023-12-15T11:06:12.044968+00:00 [info] msg: terminate, mfa: emqx_connection:terminate/2(673), peername: 123.456.7.8:45826, reason: {shutdown,tcp_closed}
mqttx的日志:
[2023-12-15 19:05:05] [INFO] Connect client 本地MQTT服务器_copy, MQTT/TCP connection: mqtt://localhost:1883 with Properties: {"sessionExpiryInterval":0,"receiveMaximum":null,"maximumPacketSize":null,"topicAliasMaximum":null,"requestResponseInformation":null,"requestProblemInformation":null,"authenticationMethod":null}
[2023-12-15 19:05:15] [INFO] 本地MQTT服务器_copy connect close, MQTT.js onClose trigger
[2023-12-15 19:05:19] [INFO] 本地MQTT服务器_copy reconnect: 0 times retry
hi,这是 MQTTX 的已知问题,我们正在着手调查修复。
目前无法在“仅配置 password” 的情况下进行连接。
如需使用 clientid+password 的认证方式,请在 MQTTX 中任意配置填写 username 为非空以进行连接。