sps-sub 0.3.4 → 0.3.5
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.tar.gz.sig +0 -0
- data/lib/sps-sub.rb +27 -10
- metadata +2 -2
- 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: ecb177d9522017c32af93507a0e21968c4d78947
|
4
|
+
data.tar.gz: c7cd61be1e396a02663be49bfb9424a9d0d883a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cfa0287c81d44bc5288c0142981303eb9a7fd9d35a61529ab3c59d556f3ef6a39226f23165b9333dd000e76fef7e77ea74914c1c839f753894fe3527f533dc2
|
7
|
+
data.tar.gz: a6ecc785b46fd145998cd8c2b824987d71ebc1c2211e4f63e6a383468daea9eaa0efe3139a535590e11a8b2fe7752d2584dc4f8d1eb917b35d9d3c16f8ee1dfd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/sps-sub.rb
CHANGED
@@ -7,12 +7,20 @@ require 'websocket-eventmachine-client'
|
|
7
7
|
|
8
8
|
class SPSSub
|
9
9
|
|
10
|
-
def initialize(port: '59000', host: nil, address: nil, callback: nil)
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
def initialize(hosts: [], port: '59000', host: nil, address: nil, callback: nil )
|
11
|
+
|
12
|
+
if host.nil? and address.nil? and hosts.any? then
|
13
|
+
hostx, portx = hosts.first.split(':',2)
|
14
|
+
portx ||= port
|
15
|
+
@host, @port = hostx, portx
|
16
|
+
else
|
17
|
+
@host = host || address || 'localhost'
|
18
|
+
@port = port.to_s
|
19
|
+
end
|
20
|
+
|
14
21
|
@callback = callback
|
15
22
|
@retry_interval = 1
|
23
|
+
@hosts = hosts
|
16
24
|
|
17
25
|
# Trap ^C
|
18
26
|
Signal.trap("INT") {
|
@@ -83,12 +91,21 @@ class SPSSub
|
|
83
91
|
|
84
92
|
return if @status == :quit
|
85
93
|
|
86
|
-
@
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
94
|
+
if @hosts.any? then
|
95
|
+
|
96
|
+
hostx, portx = @hosts.rotate!.first.split(':',2)
|
97
|
+
portx ||= @port
|
98
|
+
@host, @port = hostx, portx
|
99
|
+
client.em_connect topic
|
100
|
+
|
101
|
+
else
|
102
|
+
@retry_interval *= 2
|
103
|
+
sleep @retry_interval
|
104
|
+
@retry_interval = 1 if @retry_interval > 30
|
105
|
+
|
106
|
+
puts "retrying to connect to #{@host}:#{@port}... "
|
107
|
+
client.em_connect topic
|
108
|
+
end
|
92
109
|
end
|
93
110
|
|
94
111
|
ws.onerror do |error|
|
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.5
|
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: 2017-
|
34
|
+
date: 2017-05-20 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: websocket-eventmachine-client
|
metadata.gz.sig
CHANGED
Binary file
|