class Magellan::Cli::Messaging::Mqtt

Public Instance Methods

get(topic = nil) click to toggle source
# File lib/magellan/cli/messaging/mqtt.rb, line 19
def get(topic = nil)
  topic, payload = *core.get_message(topic)
  $stderr.puts topic
  $stdout.puts payload.ascii_only? ? payload : payload.inspect
rescue Magellan::Cli::Error
  raise
rescue => e
  show_error_and_exit1(e)
end
pub(topic, payload) click to toggle source
# File lib/magellan/cli/messaging/mqtt.rb, line 9
def pub(topic, payload)
  core.publish(topic, try_reading_file(payload).dup)
  log_success "\e[32mOK\e[0m"
rescue Magellan::Cli::Error
  raise
rescue => e
  show_error_and_exit1(e)
end