Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish by mosquitto client with QoS higer than 0 not allowed for V5 #1442

Closed
Do4bled opened this issue Jun 22, 2022 · 3 comments
Closed

Publish by mosquitto client with QoS higer than 0 not allowed for V5 #1442

Do4bled opened this issue Jun 22, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@Do4bled
Copy link

Do4bled commented Jun 22, 2022

Describe the bug

When trying to publish a message with a higher QoS than 0 using the mosquitto_pub.exe client the client disconnects with the error message "Error: Message QoS not supported on broker, try a lower QoS."
If I remove the -V mqttv5 option from the command parameters the message get published to the broker without any errors. Mosquitto uses the mqttv311 by default.

Which component is your bug related to?

  • Server

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of MQTTnet 'latest'.
  2. Add the below code to a simple C# console application and run it to start the server.
  3. Download the latest mosquitto installer and install the product.
  4. Navigate to the install dir from a command prompt and find mosquitto_pub.exe
  5. use the following parameters (assuming default port and localhost). "mosquitto_pub.exe -t samples/temperature -i "clientid2" -q 2 -d -m "test4" -V mqttv5"
  6. See error.
  7. Rerun the commando with the "-q" option changed to "-q 1"
  8. see the error
  9. Rerun the commando with the "-q" option changed to "-q 0"
  10. see that the message is accepted by the server
  11. Rerun the commando without the "-V mqttv5" with with the "-q" set back to 2
  12. see that the message is accepted by the server.

Expected behavior

that regardless of the mqtt version the message must be accepted by the server. especially as mentioned in bug #1425 that QoS is "supported".

Additional context / logging

C:\Program Files\mosquitto>mosquitto_pub.exe -t samples/temperature -i "clientid2" -q 2 -d -m "test4" -V mqttv5
Client clientid2 sending CONNECT
Client clientid2 received CONNACK (0)
Error: Message QoS not supported on broker, try a lower QoS.
Client clientid2 sending DISCONNECT

C:\Program Files\mosquitto>mosquitto_pub.exe -t samples/temperature -i "clientid2" -q 2 -d -m "test4"
Client clientid2 sending CONNECT
Client clientid2 received CONNACK (0)
Client clientid2 sending PUBLISH (d0, q2, r0, m1, 'samples/temperature', ... (5 bytes))
Client clientid2 received PUBREC (Mid: 1)
Client clientid2 sending PUBREL (m1)
Client clientid2 received PUBCOMP (Mid: 1, RC:0)
Client clientid2 sending DISCONNECT

Code example

static void Main(string[] args)
        {
            var mqttFactory = new MqttFactory();

            var options = new MqttServerOptionsBuilder()
                .WithDefaultEndpoint()
                .Build();

            var mqttServer = mqttFactory.CreateMqttServer(options);

            mqttServer.StartAsync();

            while(true)
            {
                Thread.Sleep(TimeSpan.FromSeconds(2));
            }
        }
@chkr1011
Copy link
Collaborator

Thanks for reporting the issue. Please test with version 4.0.2.197 from the MyGet feed (see Readme) and let me know if it works now.

@Do4bled
Copy link
Author

Do4bled commented Jun 27, 2022

Hi, I have no idea how to get content from the MyGet feed ( and could not find anything in the readme) but I took the code from the branch that was created for this issue, compiled the server and tested it. the fix works fine, and the behavior is as expected.

@chkr1011
Copy link
Collaborator

Thanks for your feedback. The patch will be part of the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants