0

environment:

When i subscribe more than 8 topics , the event MqttMsgSubscribed won't be triggered. according the situation , i think the subscribtion is not successed.

Console.WriteLine("AWS IOT dotnetcore message consumer starting");
int BrokerPort = 8883;
string ClientId = Guid.NewGuid().ToString();
var IotClient = new MqttClient(IotEndPoint, BrokerPort, true, CaCert,
                               ClientCert, MqttSslProtocols.TLSv1_2);

IotClient.MqttMsgSubscribed += IotClient_MqttMsgSubscribed;
IotClient.MqttMsgPublishReceived += IotClient_MqttMsgPublishReceived;

// for figuring the issue
IotClient.ConnectionClosed += (s, e) => Console.WriteLine(s.ToString() + " " + e.ToString());

IotClient.Connect(ClientId);

string[] topic = { 
 "bq/test/Hello/World2", "bq/test/Hello/World3", 
 "bq/test/Hello/World4", "bq/test/Hello/World5",
 "bq/test/Hello/World6", "bq/test/Hello/World7",
 "bq/test/Hello/World8", "bq/test/Hello/World9",
 "bq/test/Hello/World" 
};
Console.WriteLine("Connected to AWS IOT");            

IotClient.Subscribe(topic, new byte[] { 
 MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, 
 MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE,
 MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, 
 MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, 
 MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE 
});

while (true)
{
     //Keeping the mainthread alive for the event receivers to get invoked
}

the result is

i don't know why the ConnectionClosed event occur when i subscribe more than 8 topics

please help me or give me some tips. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.