MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
MIT License
4.5k
stars
1.07k
forks
source link
Network protocol error for subscriptions is raised (after publishing) #1310
So specifying a client id or the protocol version 31 helps. The protocol versions 311 (default) and 5 are faulty.
Using the MQTTnet client does also work btw.
Describe the bug
A network protocol error for ongoing subscriptions is raised after publishing a message to the server. The error cancels the subscriptions.
Platform:
Client:
Server:
Important: This issue is not only related to the test app. We also experience it in our server app.
Which project is your bug related to?
To Reproduce
Steps to reproduce the behavior:
MQTTnet.TestApp.AspNetCore2
project directory88-92
inProgram.cs
(to make the app build and run)dotnet run --framework net5.0
./mosquitto_sub -h localhost -p 1883 -t '#' -q 1
./mosquitto_pub -h localhost -p 1883 -t "test/foo" -m "message"
Expected behavior
We expect no network protocol error to occur (which cancels the subscription).
Screenshots
Subscription:
Publish:
Additional context / logging
We found a couple of workarounds for this problem. The following commands avoid a network protocol error:
./mosquitto_sub -h localhost -p 1883 -t '#' -q 1 -i "client id"
or./mosquitto_sub -h localhost -p 1883 -t '#' -q 1 -V 31
or./mosquitto_pub -h localhost -p 1883 -t "test/foo" -m "message" -V 31
So specifying a client id or the protocol version
31
helps. The protocol versions311
(default) and5
are faulty. Using the MQTTnet client does also work btw.Greetings!