sps-sub 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sps-sub.rb +15 -5
- metadata +4 -4
- 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: 8d52f56bc416cad1645e9daebc0d9719ca7cf621
|
4
|
+
data.tar.gz: db3cdf09db9a9f478d460d4586c5b4e303f123a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95f8b9642dfb34eedb057d23e1b4a005a4b9138ce4e5a0e9c8e9029d4e91684bd3b3a48bbb53c11bd7b2463fa6a2f882447711c42f5af45957e96d1ba3c0c75b
|
7
|
+
data.tar.gz: 6865ba029b52186bead910b3e57a3d852259962f6ba368229a836a1d11824ce9249ba9c88a8907ce4deb2bad009b24a515681e361299caa36a1b463c97f9da78
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/sps-sub.rb
CHANGED
@@ -12,6 +12,7 @@ class SPSSub
|
|
12
12
|
@host = host || address || 'localhost'
|
13
13
|
@port = port.to_s
|
14
14
|
@callback = callback
|
15
|
+
@retry_interval = 1
|
15
16
|
|
16
17
|
# Trap ^C
|
17
18
|
Signal.trap("INT") {
|
@@ -28,10 +29,15 @@ class SPSSub
|
|
28
29
|
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
+
def notice(s)
|
33
|
+
|
34
|
+
EventMachine.next_tick do
|
35
|
+
@ws.send s
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
32
39
|
|
33
40
|
def subscribe(topic: '#', &blk)
|
34
|
-
|
35
41
|
|
36
42
|
@t = Time.now
|
37
43
|
|
@@ -47,7 +53,7 @@ class SPSSub
|
|
47
53
|
|
48
54
|
address = host + ':' + port
|
49
55
|
|
50
|
-
ws = WebSocket::EventMachine::Client.connect(:uri => 'ws://' + address)
|
56
|
+
@ws = ws = WebSocket::EventMachine::Client.connect(:uri => 'ws://' + address)
|
51
57
|
|
52
58
|
ws.onopen do
|
53
59
|
puts "Connected"
|
@@ -76,8 +82,12 @@ class SPSSub
|
|
76
82
|
puts "Disconnected"
|
77
83
|
|
78
84
|
return if @status == :quit
|
79
|
-
|
80
|
-
|
85
|
+
|
86
|
+
@retry_interval *= 2
|
87
|
+
sleep @retry_interval
|
88
|
+
@retry_interval = 1 if @retry_interval > 30
|
89
|
+
|
90
|
+
puts "retrying to connect to #{@host}:#{@port}... "
|
81
91
|
client.em_connect topic
|
82
92
|
end
|
83
93
|
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
eWXz4xiizWWSrPuPJABF8HbFYS84edVCuWiEBU5ZWKNpKrx22oDT1PoyBa5tSK6G
|
32
32
|
GFAzdFN+JAj2mQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2017-02-04 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: websocket-eventmachine-client
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 1.1.0
|
56
56
|
description:
|
57
|
-
email: james@
|
57
|
+
email: james@jamesrobertson.eu
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.8
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Subscribes to a SimplePubsub (SPS) broker
|
metadata.gz.sig
CHANGED
Binary file
|