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

MQTTv5 client cannot connect to broker that only supports max. MQTTv3.1.1 #1060

Open
1 task
HaKAtWork opened this issue Oct 11, 2024 · 3 comments
Open
1 task

Comments

@HaKAtWork
Copy link

  • [x ] Bug exists Release Version 1.2.5 ( Master Branch) MQTTv5
  • Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch): not tested

Test with (very old) mosquitto version 1.5.5 (MQTTv5 client)
Debug-Messages from mosquitto:
New connection from ....
Invalid protocol version 5 in CONNECT from ....
Sending CONNACK to ...
Socket error on client , disconnecting.

Test with (very old) mosquitto version 1.5.5 (MQTTv3 client)
no error
Debug-Messages from mosquitto:
New connection from...
New client connected from ...

There is no way to set the MQTT version as in the MQTTv3 client (setMqttVersion), because the method is missing. Is no automatic fallback to V3.1.1 implemented?

@ssams
Copy link

ssams commented Oct 23, 2024

I'd argue that this is fully intentional and working as designed - it's a v5 client after all!? there are quite some changes between the two protocol versions, supporting both via the same API is probably quite cumbersome and confusing (if you cannot use certain functions depending on which broker you'd be connected to, etc.)

@fpagliughi
Copy link

I have not looked at the code, but I agree with @ssams, for whichever language/library you use. If you request an MQTT v5 connection, it should definitely fail if that is not supported by the server. The v5 protocol has quite a number of new features, and if the client needs to use those features, it should be told explicitly that it can not.

If the client can make use of v3, it can always retry the connection using the v3 protocol. For that matter, if it is not going to make use of v5, and is likely to connect to an old broker, it should probably just request a v3 connection from the begining.

@HaKAtWork
Copy link
Author

I would like to be able to connect to different brokers with one (Java) client. These different brokers support different versions of Mqtt.
To be able to support both V3 and V5, I have to integrate both libs in the client.
I would like to be able to use V3 with one lib (without using the new features).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants