Skip to content

Instantly share code, notes, and snippets.

@michaelklishin michaelklishin/mqtt_ssl.rb Secret
Created Jun 27, 2014

Embed
What would you like to do?
#!/usr/bin/env ruby
require 'rubygems'
require "mqtt"
client = MQTT::Client.new('localhost', :ssl => :TLSv1)
client.ca_file = "/Users/antares/Tools/rabbitmq/tls/ca_certificate.pem"
client.cert_file = "/Users/antares/Tools/rabbitmq/tls/client_certificate.pem"
client.key_file = "/Users/antares/Tools/rabbitmq/tls/client_key.pem"
client.connect do
client.subscribe('test')
# Send a message
client.publish('test', "hello world")
# If you pass a block to the get method, then it will loop
topic, message = client.get
p [topic, message]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.