simplepubsub 1.2.0 → 1.2.1
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/simplepubsub.rb +17 -14
- 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: bc7b8839c716ed5d08576e646e35f512ffdf7487
|
|
4
|
+
data.tar.gz: 467c2f9bc7afcb2468c81f9e12047e77b2f59065
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e35623005cec1fa962299ef6ae32744bf78841a834b096dc99b9001a43ae8bda2b516ac48925c75c01d476ce6fde3e8c8a81ab9b47e2dc1a4dc4f9cd0d3503a4
|
|
7
|
+
data.tar.gz: 82c22bb7f9c83fb858613739ee711669fa4f009cdf06fe19ea48c78b5a0eb7349b97cdbe1916310f4da0b1052f9256be90574c457c6e21e0f2f0f4ae1fd45360
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/simplepubsub.rb
CHANGED
|
@@ -31,6 +31,7 @@ module SimplePubSub
|
|
|
31
31
|
def ws.subscriber?()
|
|
32
32
|
false
|
|
33
33
|
end
|
|
34
|
+
|
|
34
35
|
|
|
35
36
|
if a.first == 'subscribe to topic' then
|
|
36
37
|
|
|
@@ -47,32 +48,34 @@ module SimplePubSub
|
|
|
47
48
|
|
|
48
49
|
elsif a.length > 1 and a.first != ''
|
|
49
50
|
|
|
50
|
-
#puts "publish this %s: %s" % a
|
|
51
51
|
current_topic, message = a
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
|
|
53
|
+
if not current_topic[0] == '/' and \
|
|
54
|
+
not current_topic =~ /[^a-zA-Z0-9\/_ ]$/ then
|
|
55
|
+
|
|
56
|
+
reg = XMLRegistry.new
|
|
57
|
+
reg[current_topic] = message
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
reg[current_topic] = message
|
|
59
|
+
subscribers.each do |topic,conns|
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
node = reg.doc.root.xpath topic.sub(/\S\b$/,'\0/text()')
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
if node.any? then
|
|
64
|
+
conns.each {|x| x.send current_topic + ': ' + message}
|
|
65
|
+
end
|
|
61
66
|
|
|
62
|
-
if node.any? then
|
|
63
|
-
conns.each {|x| x.send current_topic + ': ' + message}
|
|
64
67
|
end
|
|
65
|
-
|
|
68
|
+
|
|
69
|
+
reg = nil
|
|
70
|
+
|
|
66
71
|
end
|
|
67
|
-
reg = nil
|
|
68
|
-
#ws.send msg, :type => type
|
|
69
72
|
|
|
70
73
|
end
|
|
71
74
|
|
|
72
75
|
end
|
|
73
76
|
|
|
74
77
|
ws.onclose do
|
|
75
|
-
|
|
78
|
+
|
|
76
79
|
if ws.respond_to? :subscriber_topic then
|
|
77
80
|
subscribers[ws.subscriber_topic].delete ws
|
|
78
81
|
end
|
|
@@ -89,4 +92,4 @@ if __FILE__ == $0 then
|
|
|
89
92
|
|
|
90
93
|
SimplePubSub::Broker.start
|
|
91
94
|
|
|
92
|
-
end
|
|
95
|
+
end
|
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.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
kIiwfbNsuzjbgWzdKm7Rmqd2eqM34Vn+TRGopqMQ8lTxyrQst+2LQnDV0BVrkl+h
|
|
32
32
|
GtYDHIOX5GPNIg==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2015-
|
|
34
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: websocket-eventmachine-server
|
metadata.gz.sig
CHANGED
|
Binary file
|