sps-pub 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/sps-pub.rb +20 -11
- data.tar.gz.sig +0 -0
- metadata +17 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d122d08cef7d23819d053ec58d3cea09d2d627d5
|
4
|
+
data.tar.gz: 1e8ad0b8e022b9cc7b10f7a57a1dd76fa89bcb02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 870c57fcb6d1beddaf4e6a84c755b4a328170927faea14fc267c9c5d9b6c4933f736295606ab1dd9aaa92482d7c25d358adf721b5b98f14e6f4b4952a79fbd0d
|
7
|
+
data.tar.gz: 1b6de1935c4cba6ea909e94ad7d83af3fb3f3c565b0aa1841a567dff422a2c18a84ad5172a53bb243abaa02f9dbab0fa53bbbf344cf007eb3789e05f59c40bd4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sps-pub.rb
CHANGED
@@ -3,31 +3,40 @@
|
|
3
3
|
# file: sps-pub.rb
|
4
4
|
|
5
5
|
require 'simplepubsub'
|
6
|
+
require 'ws' # from gem 'simpleblockingwebsocketclient'
|
7
|
+
|
8
|
+
|
6
9
|
|
7
10
|
class SPSPub
|
8
11
|
include SimplePubSub
|
9
12
|
|
10
|
-
def self.notice(s,
|
13
|
+
def self.notice(s, address: 'sps', port: '59000')
|
11
14
|
|
12
|
-
|
15
|
+
client = Net::WS.new "ws://%s:%s/" % [address, port]
|
16
|
+
client.send s
|
17
|
+
end
|
13
18
|
|
14
|
-
|
19
|
+
def self.pub(s, address: 'sps', port: '59000')
|
20
|
+
self.notice(s, address: 'sps', port: '59000')
|
21
|
+
end
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
client.publish(topic, msg)
|
19
|
-
:stop if opt[:stay_connected] == false
|
20
|
-
end
|
21
|
-
|
23
|
+
def self.publish(s, address: 'sps', port: '59000')
|
24
|
+
self.notice(s, address: 'sps', port: '59000')
|
22
25
|
end
|
26
|
+
|
23
27
|
|
24
|
-
def self.listen(topic='#',
|
28
|
+
def self.listen(topic='#', address: 'sps')
|
25
29
|
|
26
|
-
Client.connect(
|
30
|
+
Client.connect(address) do |client|
|
27
31
|
client.get(topic) do |topic, message|
|
28
32
|
puts "[%s] SPS listener INFO %s: %s" %
|
29
33
|
[Time.now.strftime("%Y-%m-%d %H:%M"), topic, message]
|
30
34
|
end
|
31
35
|
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.subscribe(topic='#', address: 'sps')
|
39
|
+
self.listen(topic='#', address: 'sps')
|
32
40
|
end
|
41
|
+
|
33
42
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sps-pub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
2cSEZ0QYbEwC3czzwEism6iYWhlBI/srC6g8JIr7pq91FybciqI5dk5RB7SE5Xgf
|
32
32
|
p7uZNkO8qc9/fg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: simplepubsub
|
@@ -47,6 +47,20 @@ dependencies:
|
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: simpleblockingwebsocketclient
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
50
64
|
description:
|
51
65
|
email: james@r0bertson.co.uk
|
52
66
|
executables: []
|
@@ -74,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
88
|
version: '0'
|
75
89
|
requirements: []
|
76
90
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.1.11
|
78
92
|
signing_key:
|
79
93
|
specification_version: 4
|
80
94
|
summary: A SimplePubSub client for publishing or subscribing to messages in 1 line
|
metadata.gz.sig
CHANGED
Binary file
|