0
Mqtt如何管理互联网断开连接?MQTT不触发ConnectionClosed
void Connection() {
MqtClient client = new MqttClient (brokerEndPoint,brokerPort,false,null,null,MqttSslProtocols.TLSv1_2);
client.MqttMsgPublishReceived += ReceiveFromSubScribedChannel;
client.MqttMsgPublished += ReceivePublishAcknwldg;
client.ConnectionClosed += OnClientdisconnected;
client_id="client_" + UnityEngine.Random.Range (1, 111);
client.Connet(client_id);
}
对我来说,回调ConnectionClosed没有触发任何消息。在这方面谁能帮助我?
您如何测试ConnectionClosed回调? – hardillb
通过关闭我的无线网络 – Salma572
我可以通过连接客户端,如下面的client.Connet(client_id,username,password,fals,3)来解决这个问题。其中3是我的生存期,我能够收到回调.. – Salma572