Comments (3)
Similar question here - would like to pickup the ConnectAck value of 4 which according to the spec should indicate incorrect username and password - not seeing how to get the return value .. tried looking at the cpp and I see reference to ConnectAck being a class but can't figure out how to catch it
from pubsubclient.
I've just pushed an update. It's work I did in May last year but didn't get around to pushing to github - I hadn't tested it on actual hardware and was afraid of breaking peoples' projects (even though a lot of the work involved getting the old testing framework working again).
Anyway, one of the changes I made was that PubSubClient::connect() returns false if the return code in the CONNACK packet doesn't equal zero. If you really need the rc value I could add that.
from pubsubclient.
Great - thanks! I will test that and I can probably make that work. If your curious on the use case I have a project where the current code only supports anonymous connections but there is a request to also support U/P. There is already the concept of an ID/pwd for other purposes so my thought was I could just update the code to try anonymous first and if it gets rc 5 (what Mosquito at least sends when password is required) then catch that and retry with the existing username and password. That way no existing anonymous users have to change anything and I don't have to update the configuration UI with options around this mqtt security. Anyway appreciate the work, I really wish I was more proficient in c/c++ or I would try to help and submit a PR - I did notice the project you forked from has rc support if you ever do want to add it.
Thanks again and will test it out tonight and let you know
(For my test I will just pickup the failure, assume it may be due to u/p required, try one more time with U/p and if that still doesn't work consider it a failure)
from pubsubclient.
Related Issues (20)
- Subscribe to two topics?
- Compatibility broken with original knolleary/pubsubclient lib HOT 1
- lib update installs the knolleary lib HOT 4
- Message published multiple times HOT 1
- MAX transfer size is not found
- more than one Nodemcu clients can't able to get published message at a time HOT 1
- Multiple unsubscribe or publish with QoS 1 in callback HOT 1
- How to set the callback from a c++ class? HOT 1
- wrong hostname used
- esp12F heating issue HOT 1
- Unable to ascertain if received message is 'retained'. HOT 15
- socket error
- ESP32 HOT 1
- Memory leak on loop() HOT 1
- can this library subscribe to mqtt topic ? HOT 1
- error "MQTT' does not name a type" when compiling ESP8266-OTA example HOT 1
- PubSubClient.connect with userName/password ? HOT 1
- control reaches end of non-void function HOT 1
- beebotte.com - retain vs write API (weird persistance, possible to add) - not a bug I think
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pubsubclient.