examples/livetext.rb in mqtt-0.0.2 vs examples/livetext.rb in mqtt-0.0.3
- old
+ new
@@ -2,17 +2,13 @@
$:.unshift File.dirname(__FILE__)+'/../lib'
require 'mqtt'
-
client = MQTT::Client.new('hadrian.aelius.com')
-client.connect('livetextclient')
-
-client.subscribe('livetext/#')
-
-loop do
- topic,message = client.get
- puts "#{topic}: #{message}"
-end
-
-client.disconnect
+client.connect do
+ client.subscribe('livetext/#')
+ loop do
+ topic,message = client.get
+ puts "#{topic}: #{message}"
+ end
+end
\ No newline at end of file