Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'mqtt'
- require 'json'
- HOST = '192.168.x.x'
- PORT = 1883
- MQTT::Client.connect(remote_host: HOST, remote_port: PORT, username: 'test', password: 'test') do |client|
- client.get('test') do |topic, message|
- data = JSON.parse(message)
- puts "#{topic}: #{data}.class = #{data.class}"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement