环境信息
- EMQ X 版本:V4.3.8
- 操作系统及版本:centos 7
- 其他
问题描述
等待来自服务器的响应时超时,重新连接提示已断开客户机连接 (32101),必须重启client;
session = true
#是否断线重连
.econnect = true
#连接超时时间
timeout = 120
#心跳间隔
keepAlive = 60
配置文件及日志
默认配置,日志级别debug,
emqx_connection.erl, line: 520, mfa: {emqx_connection,terminate,2}, msg: terminate, pid: <0.2222.0>, reason: {shutdown,idle_timeout}
你的终端没有发连接数据包,只是做了TCP连接。
尝试一下
MqttClient client = new MqttClient(brokerUrl, clientID, new MemoryPersistence());
if(!client.isConnected()){
client.connect();
}
感谢回复,connectionLost 具体实现如下,目前还未找到原因
你的代码wile循环倒数第二句close了,然后连接,肯定会报错的
[quote=“DDDHuang, post:4, topic:1014”]
e循环倒数第二句close了,然
[/quote] 因为client.reconnect();重新连不上,所以实现写了 close ,等待来自服务器的响应时超时 ,怎么验证client 是否发连接数据包