We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
while (mqClient.IsConnected == false) { await mqClient.ReConnectAsync(); Log4NetUtil.Info("ReConnectAsync", new Dictionary<string, object> { { "ConnectResult",connectResult}, { "mqClientIsConnected", mqClient.IsConnected } }); } 在里面加了日志没有打印出来 怀疑mqClient.IsConnected还是true, 但定时30秒client.SendMessageAsync返回是Disconnected了 后面改成do while,只打印出了OnConnectionLost,mqClientIsConnected:False ,里面ReConnectAsync还是没有打印出来,ReConnectAsync会卡死了?
client.OnConnectionLost += async (sender) => { var mqClient = sender as MqttClient; Log4NetUtil.Info("OnConnectionLost", new Dictionary<string, object> { { "mqClientIsConnected", mqClient.IsConnected }}); ConnectError connectResult = ConnectError.NotAuthorized; do { try { connectResult = await mqClient.ReConnectAsync(); Log4NetUtil.Info("ReConnectAsync", new Dictionary<string, object> { { "ConnectResult",connectResult}, { "mqClientIsConnected", mqClient.IsConnected } }); await mqClient.SubscribeAsync(subTopic, MqttQoS.AtMostOnce); Log4NetUtil.Info("SubscribeAsync", new Dictionary<string, object> { }); } catch (Exception ex) { Log4NetUtil.Error("ReConnectAsync", new Dictionary<string, object> { { "ex", ex.ToString() } }); } await Task.Delay(5000); } while (!mqClient.IsConnected && connectResult != ConnectError.ConnectionAccepted); };
The text was updated successfully, but these errors were encountered:
这个项目太老不维护了,推荐https://github.com/chkr1011/MQTTnet
Sorry, something went wrong.
好的,谢谢
No branches or pull requests
while (mqClient.IsConnected == false)
{
await mqClient.ReConnectAsync();
Log4NetUtil.Info("ReConnectAsync", new Dictionary<string, object>
{
{ "ConnectResult",connectResult},
{ "mqClientIsConnected", mqClient.IsConnected }
});
}
在里面加了日志没有打印出来
怀疑mqClient.IsConnected还是true,
但定时30秒client.SendMessageAsync返回是Disconnected了
后面改成do while,只打印出了OnConnectionLost,mqClientIsConnected:False ,里面ReConnectAsync还是没有打印出来,ReConnectAsync会卡死了?
The text was updated successfully, but these errors were encountered: