Code Monkey home page Code Monkey logo

Comments (5)

andsel avatar andsel commented on July 17, 2024 1

MQTT 5.0 in version 0.17

Just a note, Moquette v0.17 doesn't implement MQTT5

from moquette.

andsel avatar andsel commented on July 17, 2024

I'll check this, but from MQTT specification http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html :

If the Server receives a QoS 0 message with the RETAIN flag set to 1 it MUST discard any message previously retained for that topic. It SHOULD store the new QoS 0 message as the new retained message for that topic, but MAY choose to discard it at any time - if this happens there will be no retained message for that topic [MQTT-3.3.1-7].

So the server MUSTN'T store the retain in session state if the QoS is 0.

However I'll check this. Thanks for reporting!

from moquette.

AndroidDesigner avatar AndroidDesigner commented on July 17, 2024

Your welcome dear @andsel
Did you implement MQTT 5.0 in the code?
You wrote in #808 :

Retain As Published

The Retain As Published option has two possible values, 0 and 1.

    1 means the server should preserve the Retain flag unchanged when forwarding application messages to subscribers
    0 means that the Retain flag must be cleared.
    Also this setting is used in bridging situations.

It seems you have used this logic in the moquette version 0.17.

from moquette.

andsel avatar andsel commented on July 17, 2024

Did you implement MQTT 5.0 in the code?
I'm implementing it, but for v0.18-SNAPSHOT

It seems you have used this logic in the moquette version 0.17.

How it's possible if the Retain As Published option only exists in MQTT5 subscribe and that code is part of 0.18?

Retain As Published relates to the fact that the retain flag of a publish message should be forwarded as it's received from the publisher (used in proxy use cases) or must be cleared. But this is unspecified in MQTT3 (if I'm not wrong).

While the problem you are reporting relates to the fact that a publish with QoS0 and retained = true it's not effectively retained, as I can understand from your description.

from moquette.

AndroidDesigner avatar AndroidDesigner commented on July 17, 2024

How it's possible if the Retain As Published option only exists in MQTT5 subscribe and that code is part of 0.18?

Retain As Published relates to the fact that the retain flag of a publish message should be forwarded as it's received from the publisher (used in proxy use cases) or must be cleared. But this is unspecified in MQTT3 (if I'm not wrong).

I know what you mean, but I thought maybe you did it (MQTT 5.0 in version 0.17) wrong.
So, you must check your implementation to check why retain=true does not work with QoS=0 in version 0.17.
You can check it simply using the below:

#First publish a sample topic:
mosquitto_pub -h host.com -p moqttPort -u username1 -P password1 -i clientID1 -t topic1 -m message1 -r -q 0

#Then subscribe to get last published (retained) message of the above topic:
mosquitto_sub -h host.com -p mqttPort -u username2 -P password2 -i clientID2 -t topic1

While the problem you are reporting relates to the fact that a publish with QoS0 and retained = true it's not effectively retained, as I can understand from your description.

Exactly! That's what I mean

from moquette.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.