simplepubsub 1.2.3 → 1.3.0

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: 5f36ec32273a0f8bd501ed28e40289c8c8711736
4
- data.tar.gz: ce1167bd984860112ad35e8a140692a49ab0c38b
3
+ metadata.gz: 3eebf1de4a72aeac11dcbcce95290b93b4a0fc2c
4
+ data.tar.gz: ddccd6756fbe4a6966df3a531122c503a38710bc
5
5
  SHA512:
6
- metadata.gz: dfa9045634ba126461a286d333a835c58f091cddb1dd76eb02342db9b7dfd0d2cecaec146ec0842bee57c0715ef014aeebf9499e2a4b9b4de3717366e5522003
7
- data.tar.gz: 0fb20abdd3dce87bb4b27c5cfbe2cd53948485bfa1173d71e073cd38dcf595ce44e2a7eae9a1506ef1639e131c779ab7a33bf5a6220c133f9642a61c9332d8bd
6
+ metadata.gz: b1672e08f3427c42c85b4fdf5fe90db13c4fb054ee3792554e2de0927823f6f65f44648e43bea329063395d21084ee3f85587567ff6c7f0d5bcdd9797dce7ae1
7
+ data.tar.gz: d25884ca74467d9539a0187fd7db6e3f6229fb80a66b2a9f7a6068e98d5ebbccea84fce5adbe5d82fc3e1c16e3dbf2bcd99cc682521e4b6387273628250f876c
checksums.yaml.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- ��"����FX�M�ʉ��zqS5��b/�0nr��� �"B�Eռf����e���g9sepy��|
2
- ���:7gŖ�=��Z4����m`��X�i^�L�R%���v���S��du<��!�\8�+�M_���Px��eF
3
- ��>
4
- O���CI@#
1
+ ^���cd>ɳ)�T��$LXa�e��vTtH7Յ��tP
2
+ ���C �ڑ��EG�bNʑ���[L�j���\������(�P��U�1��\�u��:� Q��Ӹ�+wE�t~�* P}�l�{S��ȳ5��;PG,�1
data/lib/simplepubsub.rb CHANGED
@@ -2,8 +2,11 @@
2
2
 
3
3
  # file: simplepubsub.rb
4
4
 
5
- require 'websocket-eventmachine-server'
5
+ require "socket"
6
+ require 'sps-pub'
6
7
  require 'xml-registry'
8
+ require 'websocket-eventmachine-server'
9
+
7
10
 
8
11
 
9
12
  module SimplePubSub
@@ -11,7 +14,7 @@ module SimplePubSub
11
14
  class Broker
12
15
 
13
16
 
14
- def self.start(host: '0.0.0.0', port: 59000)
17
+ def self.start(host: '0.0.0.0', port: 59000, brokers: [])
15
18
 
16
19
 
17
20
  EM.run do
@@ -26,7 +29,7 @@ module SimplePubSub
26
29
 
27
30
  ws.onmessage do |msg, type|
28
31
 
29
- msg = '' if not msg[0][/\w/]
32
+ msg = '' if not msg[0][/[\w:]/]
30
33
  a = msg.lstrip.split(/\s*:\s/,2)
31
34
 
32
35
  def ws.subscriber?()
@@ -51,6 +54,33 @@ module SimplePubSub
51
54
 
52
55
  current_topic, message = a
53
56
 
57
+ # is the message from another SPS broker?
58
+
59
+ if current_topic[0] == ':' then
60
+
61
+ # strip of the broker ID
62
+ current_topic.sub!(/:\w+\//,'')
63
+
64
+ elsif brokers.any?
65
+
66
+ brokers.each do |broker|
67
+
68
+ hostx, portx = broker.split(':',2)
69
+ portx ||= port
70
+
71
+
72
+ #puts 'address: ' + address.inspect
73
+ fqm = ":%s/%s: %s" % [Socket.gethostname, current_topic, message]
74
+
75
+ begin
76
+ SPSPub.notice fqm, host: hostx, port: portx
77
+ rescue
78
+ puts "warning couldn\'t send to %s:%s" % [hostx, portx]
79
+ end
80
+ #sleep 0.5
81
+ end
82
+ end
83
+
54
84
  if not current_topic[0] == '/' and \
55
85
  not current_topic =~ /[^a-zA-Z0-9\/_ ]$/ then
56
86
  begin
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplepubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,48 +31,68 @@ cert_chain:
31
31
  ESZzN7k2ND/MlTmSRterWKMTHfqcRezLMwpCUfuiwqBZjmitwfxLISVSb6KbdmAP
32
32
  gwvxzXnCp16BVQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-03-13 00:00:00.000000000 Z
34
+ date: 2017-05-20 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: websocket-eventmachine-server
37
+ name: sps-pub
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.0'
42
+ version: '0.5'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.0.1
45
+ version: 0.5.5
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.0'
52
+ version: '0.5'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.0.1
55
+ version: 0.5.5
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: xml-registry
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0.2'
62
+ version: '0.5'
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: 0.2.3
65
+ version: 0.5.3
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
- version: '0.2'
72
+ version: '0.5'
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.3
75
+ version: 0.5.3
76
+ - !ruby/object:Gem::Dependency
77
+ name: websocket-eventmachine-server
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 1.0.1
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '1.0'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 1.0.1
76
96
  description:
77
97
  email: james@jamesrobertson.eu
78
98
  executables: []
metadata.gz.sig CHANGED
Binary file