aboutsummaryrefslogtreecommitdiff
path: root/ring.rb
diff options
context:
space:
mode:
authorNat Lasseter <Redacted>2017-07-27 16:44:56 +0100
committerNat Lasseter <Redacted>2017-07-27 16:44:56 +0100
commitf7993b536d01957e5e9cfc91af01617d7e48704c (patch)
tree4df98738c1d7ac687f2deb29cbc9c7a6bb6fe321 /ring.rb
Initial commit
Diffstat (limited to 'ring.rb')
-rw-r--r--ring.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/ring.rb b/ring.rb
new file mode 100644
index 0000000..b355075
--- /dev/null
+++ b/ring.rb
@@ -0,0 +1,14 @@
+require "rubygems"
+require "mqtt"
+
+IAM = ARGV.shift
+TO = ARGV.shift
+
+MQTT::Client.connect("server.flashinglightprize.nathan.uk0.bigv.io") do |c|
+ c.get("ring/#{IAM}") do |topic, message|
+ if message == IAM then
+ sleep 0.1
+ c.publish("ring/#{TO}", TO)
+ end
+ end
+end