ClearBlade / ClearBlade-Python-SDK

A Python SDK for interacting with the ClearBlade Platform.
Apache License 2.0
4 stars 4 forks source link

MQTT Messaging Connection Error #25

Open wildbiotiger opened 11 months ago

wildbiotiger commented 11 months ago

It seems that when Messaging.connect() is called with use_tls and times out (no network connectivity), calling connect() again results in a persistent error: ValueError('SSL/TLS has already been configured.') which prevent a successful reconnect. Shouldn't connect be able to be called repeatedly? Or is there some other reconnect workflow that's missing here?

sky-sharma commented 11 months ago

@wildbiotiger sorry for the delay in responding to this. I have recreated this and I believe you are correct: that error should not prevent a successful reconnect. I will submit a branch shortly. If it works I will submit a PR to merge it and will release a new PyPi module. I'll keep you posted.

sky-sharma commented 11 months ago

@wildbiotiger I just pushed branch prevent-connection-error-when-tls-already-configured which should fix this. Can you try running with the branch to see if it works for you?

To run from source you should do the following:

  1. Clone the repo.
  2. In your code, add some lines BEFORE the imports from the repo to designate you are running from source. So...
import sys
path_to_clearblade_module = "/path/to/your/clearblade/module"
sys.path.insert(0, path_to_clearblade_module)
from clearblade.ClearBladeCore import System, cbLogs

This should use the module from source. You can check by throwing a few print statements in the cloned repo code to see that they are being called. If you find you are NOT running the module from source then perhaps you could temporarily uninstall the PyPi module using...

python3 -m pip uninstall clearblade

...or the equivalent?

Let us know if this branch works for you. If so I'll merge the changes into the main branch and release a new version of the PyPi module and let you know.

sky-sharma commented 11 months ago

@wildbiotiger did you try this branch? Did it work for you? If it worked I would like to merge the branch.

wildbiotiger commented 11 months ago

@sky-sharma not yet, the bug isn't on the critical path for me just yet. And the hardware is now deployed out in the field. Will need to test later.