pikitgb
6/15/2015 - 9:12 PM

ruby_mqtt_facebookclient.rb

require 'mqtt'
 
topic_name = ARGV[0]
host_address = "localhost"
 
MQTT::Client.connect(host_address) do |c|
  # If you pass a block to the get method, then it will loop
  c.get(topic_name) do |topic,message|
    puts "#{topic}: #{message}"
  end
end
 
# Run
# ruby client_mqtt.rb "topic_name"
ruby client_mqtt.rb "865123576893513"