sps-sub 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bee6db849030c291086d5c12cae543749935ddb
4
- data.tar.gz: 50f01815400adaf57f61df438f34142fe15aa1d1
3
+ metadata.gz: 53970659171d8794f9ef9e5678eb5d74bdc0193f
4
+ data.tar.gz: 005ff79b8a8fe637c191d5a78c2ca655873813eb
5
5
  SHA512:
6
- metadata.gz: 1f20e7b1a9d03f7cdb2c44f95f7c1e6993d770c3abec45eacb42ee31ddbcdafe36b41452e88eae4353399545224d475decf4f3424346bf5f2153f9661876d699
7
- data.tar.gz: d01f6a9845f3c5bf7f7c656ff19d98c964cfff6cf432bfcb8800823f245f51e4eb90d6e9ae7fd13bbf95ae24a408d5baad07428777d3d58ddd61967545c29b84
6
+ metadata.gz: c90b4b210262a656d9ee82072157da212105474f8b4b5a42cd7af3fbde9c0903351038b5b33e0c5ce8f251f9a0f2115f6e42ec48e7ba9ab18f868bbc6eca1fab
7
+ data.tar.gz: 7eb490ff1f01e720d5d2a37896658f16836f936467a15d62e4885e15f03895503d211b76492c73a850057dc81717f9830abd5d07d423f6055680073e903ee7dd
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/sps-sub.rb CHANGED
@@ -29,8 +29,12 @@ class SPSSub
29
29
  puts "Connected"
30
30
  end
31
31
 
32
- ws.onmessage do |msg, type|
32
+ ws.onmessage do |fqm, type|
33
+
34
+ topic, msg = fqm.split(/:\s+/,2)
33
35
  onmessage msg
36
+ ontopic topic, msg
37
+
34
38
  end
35
39
 
36
40
  ws.onclose do
@@ -44,10 +48,18 @@ class SPSSub
44
48
  end
45
49
  end
46
50
 
51
+ # This method is called when a new message is received
52
+ #
47
53
  def onmessage(msg)
48
54
  puts "Received message: #{msg}"
49
55
  end
56
+
57
+ # Same as onmessage but includes the topic as well as the msg
58
+ #
59
+ def ontopic(topic, msg)
50
60
 
61
+ end
62
+
51
63
  end
52
64
 
53
65
  if __FILE__ == $0 then
@@ -60,4 +72,4 @@ if __FILE__ == $0 then
60
72
 
61
73
  sps.subscribe topic: 'test'
62
74
 
63
- end
75
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sps-sub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file