Skip to content

allow to specify arbitrary TLS port #140

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

Closed
vladak opened this issue Jan 8, 2023 · 0 comments
Closed

allow to specify arbitrary TLS port #140

vladak opened this issue Jan 8, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@vladak
Copy link
Contributor

vladak commented Jan 8, 2023

As mentioned in #139, some MQTT brokers accept TLS based connections on non-standard port, e.g. test.mosquitto.org:8886.

When I tried something like this:

import adafruit_minimqtt.adafruit_minimqtt as MQTT

...

    broker_port = secrets["broker_port"]  # set to 8886                                      
    MQTT.MQTT_TLS_PORT = broker_port                               
                                                                                
    # Set up a MiniMQTT Client                                                  
    mqtt_client = MQTT.MQTT(                                                    
        broker=secrets["broker"],                                               
        port=broker_port,                                                       
        socket_pool=pool,                                                       
        ssl_context=ssl_context,                                                
    )

    mqtt_client.connect()

it failed (with the changes for the above mentioned PR in place), because it tried to initiate 'INSECURE' (quoting the log message) connection.

Clearly something better than overriding global variable is needed, perhaps a new attribute with a setter. Or maybe my Python-fu is not enough and some other incantation is needed to overwrite the TLS port definition.

@tekktrik tekktrik added the bug Something isn't working label Jan 9, 2023
vladak added a commit to vladak/Adafruit_CircuitPython_MiniMQTT that referenced this issue Jan 12, 2023
vladak added a commit to vladak/Adafruit_CircuitPython_MiniMQTT that referenced this issue Jan 13, 2023
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