128 Star 1.2K Fork 557

iteaj / iotucy

 / 详情

mqtt client 连接失败 服务端收到的keepalive一直为0,设置writerIdleTime无效

已完成
创建于  
2022-12-07 20:37

iot-test模块
配置文件

iot:
    mqtt:
        default:
            host: ${iot.test.mqtt.host}
            username: admin
            password: public
            port: ${iot.test.mqtt.port}
            clean-session: true
    test:        
        client: true
        mqtt:
            AllIdleTime: 60
            host: localhost
            password:
            port: 1884
            start: true
            username:
            writerIdleTime: 60

服务端:
mosquitto

listener 1884
allow_anonymous true

报错信息:
代码

2022-12-07 18:56:50.748  WARN 18612 --- [        IWT-3-8] com.iteaj.iot.client.mqtt.MqttClient     : mqtt(MQTT<默认>) CONNACK - 状态: CONNECTION_REFUSED_IDENTIFIER_REJECTED
2022-12-07 18:56:50.748  WARN 18612 --- [        IWT-3-8] com.iteaj.iot.client.mqtt.MqttClient     : 客户端(MQTT<默认>) 断线重连(第1次) - 等待重连时间:15(s) - 远程主机 localhost:1884 - 客户端标识:IOT:DEFAULT:CLIENT:ID
2022-12-07 18:56:50.748  WARN 18612 --- [        IWT-3-7] com.iteaj.iot.client.mqtt.MqttClient     : mqtt(mqtt自定义) CONNACK - 状态: CONNECTION_REFUSED_IDENTIFIER_REJECTED
2022-12-07 18:56:50.748  WARN 18612 --- [        IWT-3-7] com.iteaj.iot.client.mqtt.MqttClient     : 客户端(mqtt自定义) 断线重连(第1次) - 等待重连时间:15(s) - 远程主机 localhost:1884 - 客户端标识:MQTT::1600444147128913920

服务端

1670410610: New client connected from 127.0.0.1:64700 as MQTT::1600444147128913920 (p2, c0, k0).
1670410610: No will message specified.
1670410610: Sending CONNACK to MQTT::1600444147128913920 (1, 2)
1670410610: Bad socket read/write on client MQTT::1600444147128913920: Invalid arguments provided.
1670410611: New connection from 127.0.0.1:64701 on port 1884.
1670410611: New client connected from 127.0.0.1:64701 as Iot:Client:Listener (p2, c0, k0).
1670410611: No will message specified.
1670410611: Sending CONNACK to Iot:Client:Listener (0, 2)
1670410611: Bad socket read/write on client Iot:Client:Listener: Invalid arguments provided.

评论 (2)

Woodrow 创建了任务

com/iteaj/iot/test/IotTestAutoConfiguration.java
147行
return new MqttClientTestComponent(properties.getMqtt());
com/iteaj/iot/test/mqtt/MqttClientTestComponent.java
29行
super(config);
com/iteaj/iot/config/ConnectProperties.java
50行
this(host, port, 60, 60, 60);

iteaj 任务状态待办的 修改为进行中
iteaj 负责人设置为iteaj
iteaj 添加了
 
bug
标签
iteaj 关联分支设置为main

确认是因为keepalive导致连接失败吗

iteaj 任务状态进行中 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
1230742 iteaj 1587373227
Java
1
https://gitee.com/iteaj/iot.git
git@gitee.com:iteaj/iot.git
iteaj
iot
iotucy

搜索帮助