Browse Source

Trying to fix disconnection issue using the paho-mqtt loop...

master
B.J. Dweck 1 year ago
parent
commit
cd51f18eab
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      torch_agent/torch_agent.py

+ 4
- 2
torch_agent/torch_agent.py View File

@ -32,7 +32,7 @@ def main():
config = configparser.ConfigParser()
configuration_file_path = config_path + "torch.conf"
print("Reading configuration file at '%s'" % (configuration_file_path))
print("Reading configuration file at '%s'" % configuration_file_path)
config.read(configuration_file_path)
tor_proxy_host = config['tor'].get('ProxyHost', fallback="127.0.0.1")
@ -76,12 +76,14 @@ def main():
print("Published payload!")
pub_client.disconnect()
def on_disconnect():
def on_disconnect(pub_client):
print("Disconnected!")
pub_client.loop_stop()
client = mqtt.Client()
client.on_publish = on_publish
client.on_disconnect = on_disconnect
client.loop_start()
protocol = "mqtt"

Loading…
Cancel
Save