dotnet / MQTTnet

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

Closed Oliver-Piorun closed 2 years ago

Oliver-Piorun commented 2 years ago

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:

  1. Navigate to the MQTTnet.TestApp.AspNetCore2 project directory
  2. Remove the lines 88-92 in Program.cs (to make the app build and run)
  3. Run the app via dotnet run --framework net5.0
  4. Subscribe via ./mosquitto_sub -h localhost -p 1883 -t '#' -q 1
  5. Publish via ./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: grafik

Publish: grafik

Additional context / logging

We found a couple of workarounds for this problem. The following commands avoid a network protocol error:

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.

Greetings!

chkr1011 commented 2 years ago

Please test with latest version 4.0 and reopen the ticket if the issue persists.