I’m trying out the dotnet example on Github (hivemq-mqtt-client-dotnet/Examples/HiveMQtt-CLI at main · hivemq/hivemq-mqtt-client-dotnet · GitHub), connect and publish a message successfully. However, when i put the publish function into a while loop to publish multiple messages ( similar to this example How to Build .Net IoT Apps Using C# MQTT Client - YouTube) , the script hits System.TimeoutException: ‘The operation has timed out.’ after just a few seconds and can only publish 2 messages at most. Below is my publish code:
Hello @qng12 ,
Thank you for the interest in HiveMQ! Welcome to the community!
Based on the sample provided, I’m curious if this has to do with the message specification change from QoS 1 to QoS 2. QoS 1 was utilized in the original example video, and has different MQTT specification requirements for delivery that could be inhibited by attempting to incorporate it into a loop as specified.
Specifically, with QoS2, there are multiple packet exchanges required between the client and broker to satisfy MQTT requirements before a single message can be considered fully delivered with QoS2. More specific details regarding QoS specifications are available here.
Would it be possible to verify if the issue persists with a QoS level of 1 or 0?
Best,
Aaron from HiveMQ Team
Thanks alot Aaron, QoS 1 and 0 indeed fix the issue.
Hello @qng12 ,
Glad to hear it - if you have any further questions, please feel free to reach out, and welcome to the HiveMQ Community!
Best,
Aaron from HiveMQ Team