Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created June 27, 2014 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelklishin/51a40e9560391b89ad0a to your computer and use it in GitHub Desktop.
Save michaelklishin/51a40e9560391b89ad0a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
client.subscribe("$SYS/#")
client = mqtt.Client()
client.on_connect = on_connect
# only CA certificate
client.tls_set("/Users/antares/Tools/rabbitmq/tls/ca_certificate.pem")
# disables peer verification
client.tls_insecure_set(True)
client.connect("localhost", 8883, 60)
client.loop_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment