-
Notifications
You must be signed in to change notification settings - Fork 11
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
Update interface to match MQTT client #27
Conversation
connecting to AWS MQTT without TLS may not be possible
@jersu11 let me know when this is ready and I'll review it. I'll also set stuff up so I can test. |
if not set, loop() default timeout is zero and MQTT default loop() timeout is one, which will raise an MMQTTException.
@justmobilize, thanks - the only thing I haven't added to this PR is a mention of the pystack setting in documentation. After reading through the current documentation for this library, I wasn't sure where the best place to put such a runtime hint. If you've got a suggestion about that, I can add it somewhere. I've made one further change today to the demo code, setting a default timeout value for the loop() that is greater than the default timeout/socket_timeout values in the MQTT client. Unless we add the pystack note to the docs, this PR should be ready for your review |
@jersu11 awesome, thank you! As for the pystack, I'm going to do some testing on this and a few other libraries. Once I have some concrete data, I will put up a separate PR to add that. |
client = MQTT.MQTT( | ||
broker=secrets["broker"], | ||
client_id=secrets["client_id"], | ||
is_ssl=True, | ||
socket_pool=pool, | ||
ssl_context=ssl_context, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jersu11 can you make sure all 3 look the same way? The native one also as port in it (which really isn't needed). The closer these are, the easier for users just to swap it out for what they need
client = MQTT.MQTT(
broker=secrets["broker"],
client_id=secrets["client_id"],
is_ssl=True,
socket_pool=pool,
ssl_context=ssl_context,
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call out. I've updated the native example to match the MQTT client settings of the other examples.
When 'is_ssl' is true in MQTT (as is required by AWS IoT), the MQTT port is automatically set to 8883.
Updating https://github.com/adafruit/Adafruit_CircuitPython_AWS_IOT to 2.0.19 from 2.0.18: > Merge pull request adafruit/Adafruit_CircuitPython_AWS_IOT#27 from jersu11/main Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Removed a method which calls a non-existent MQTT function. Adds
is_ssl=True
to two of the example files - it isn't possible to connect to AWS IoT directly without TLS/SSL enabled. Updated 'loop()' with same interface as client method.