When I run my program, everything is fine. However, this function doesn't execute anything. Starting from the line "this.Client.UseApplicationMessageReceivedHandler(e =>", the thing doesn't work. I wonder does UseApplicationMessageReceivedHandler work well with ManagedClient? Any idea on this?
private void SubscriptionHandler()
{
this.Client.UseApplicationMessageReceivedHandler(e =>
{
try
{
string topic = e.ApplicationMessage.Topic;
if (string.IsNullOrWhiteSpace(topic) == false)
{
string payload = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
Console.WriteLine($"Topic: {topic}. Message Received: {payload}");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message, ex);
}
});
}