examples/simple_get.rb in mqtt-0.0.2 vs examples/simple_get.rb in mqtt-0.0.3
- old
+ new
@@ -2,17 +2,13 @@
$:.unshift File.dirname(__FILE__)+'/../lib'
require 'mqtt'
-
client = MQTT::Client.new('mqtt.example.com')
-client.connect('simple_get')
-
-client.subscribe('test')
-
-loop do
- topic,message = client.get
- puts "#{topic}: #{message}"
+client.connect do
+ client.subscribe('#')
+ loop do
+ topic,message = client.get
+ puts "#{topic}: #{message}"
+ end
end
-
-client.disconnect