I am trying to stop my application from listening to a topic when a task end executing its job.
I tried applying the methods UnsubscribeAsync()
and DisconnectAsync()
to the IMqttClient
object serving the connection with the listening MQTT broker, but nothing happened.
Every time message is received from the broker on that topic, a new MQTT connection is created to serve the incoming message request.
What I get is that the subscription does not get ended so every time I receive a message I get one more MqttNet
task serving the message.
- First message: served once;
- Second message: served twice;
..and so on.
I'm not sure I could directly access the MQTTnet
Task to end it myself.
How can I do it?