Skip to content

Instantly share code, notes, and snippets.

@chobie
Created September 8, 2014 06:09
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 chobie/5386e46a7b9dad2276e3 to your computer and use it in GitHub Desktop.
Save chobie/5386e46a7b9dad2276e3 to your computer and use it in GitHub Desktop.
require 'mqtt'
username = "example@github"
password = "password"
client = MQTT::Client.connect(:host => 'free.mqtt.shiguredo.jp', :port => 1883, :username => username, :password => password)
client.subscribe("#{username}/debug")
client.publish("#{username}/debug", "helo", 0)
client.get do |topic,message|
print topic
print message
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment