I'm a .NET developer and a 网络砖家.
xljiulang / paho.mqttdotnet Goto Github PK
View Code? Open in Web Editor NEWA .Net wrapper for eclipse/paho.mqtt.c
A .Net wrapper for eclipse/paho.mqtt.c
I'm a .NET developer and a 网络砖家.
hi,初始化一个MqttClient,直接报如上的错误,该如何排查? 本人是在控制台程序中初始化。谢谢
另一个客户端使用相同账号登录mqtt服务器后,当前正在连接的客户端断开后再reconnect没有回应,网络断开是可以重连的,但是账号登出这种情况好像有时候重连就会没回应
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);
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.