simplepubsub 1.2.0 → 1.2.1

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: 0b7490e4aeeacc8821ee174e35b70df351298ec6
4
- data.tar.gz: fa80ab134536a7283cf6f8575962d8915d842aa4
3
+ metadata.gz: bc7b8839c716ed5d08576e646e35f512ffdf7487
4
+ data.tar.gz: 467c2f9bc7afcb2468c81f9e12047e77b2f59065
5
5
  SHA512:
6
- metadata.gz: c0c65ceeb1fa9945436d03ca63be5246d27558864b4086ee66be9edfe9e8cb1a6fc4bcf97619b68e08468199c7d2ab11d7bfb83b66a0e640fd17c4d670ff7865
7
- data.tar.gz: 11021d83a5849aeb2cac03ed02bfc5ca82fc1045c9dadf254461f834f9e2bf0714eb1c11998726e1cbb1908c1112624c8c88434758da764327481c9fc77b0a76
6
+ metadata.gz: e35623005cec1fa962299ef6ae32744bf78841a834b096dc99b9001a43ae8bda2b516ac48925c75c01d476ce6fde3e8c8a81ab9b47e2dc1a4dc4f9cd0d3503a4
7
+ data.tar.gz: 82c22bb7f9c83fb858613739ee711669fa4f009cdf06fe19ea48c78b5a0eb7349b97cdbe1916310f4da0b1052f9256be90574c457c6e21e0f2f0f4ae1fd45360
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- return if current_topic[0] == '/'
53
- return if current_topic =~ /[^a-zA-Z0-9\/_]/
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
- reg = XMLRegistry.new
56
- reg[current_topic] = message
59
+ subscribers.each do |topic,conns|
57
60
 
58
- subscribers.each do |topic,conns|
61
+ node = reg.doc.root.xpath topic.sub(/\S\b$/,'\0/text()')
59
62
 
60
- node = reg.doc.root.xpath topic.sub(/\S\b$/,'\0/text()')
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
- #puts "Client disconnected"
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.0
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-10-09 00:00:00.000000000 Z
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