celluloid_pubsub 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/celluloid_pubsub.gemspec +1 -1
- data/examples/simple_test.rb +8 -2
- data/lib/celluloid_pubsub/version.rb +1 -1
- data/lib/celluloid_pubsub/web_server.rb +6 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e59fc206ccb8f5eb1a0420099429130b92944c17
|
4
|
+
data.tar.gz: ccb987b8132c80967805995ea6b96e61c3b864f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3570bd394410645d5ab706922d3e07c079d0cbd2f969db70c2cbc81fa6cda0c695daed1eba31212d4885927735706976e1a6d912979eca2afb3485d856a6dd74
|
7
|
+
data.tar.gz: 54b8958031e1bd0db10c3aabe06785a6e5e025a3c9d7700a3170ddaa6bc703ddb045aec1b6f18ac290a0c0f9d371cc33b15a579573df2c7e4d3cd9dc2981ba57
|
data/celluloid_pubsub.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_runtime_dependency 'celluloid-io', '~> 0.16.2', '>= 0.16.2'
|
21
21
|
s.add_runtime_dependency 'reel', '~> 0.5.0', '>= 0.5.0'
|
22
22
|
s.add_runtime_dependency 'celluloid-websocket-client', '0.0.1'
|
23
|
-
s.add_runtime_dependency 'activesupport', '~> 4.
|
23
|
+
s.add_runtime_dependency 'activesupport', '~> 4.1', '>= 4.1.0'
|
24
24
|
|
25
25
|
s.add_development_dependency 'rspec-rails', '~> 2.0', '>= 2.0'
|
26
26
|
s.add_development_dependency 'guard', '~> 2.6.1', '>= 2.6'
|
data/examples/simple_test.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'celluloid_pubsub'
|
3
3
|
|
4
|
+
ENV['DEBUG_CELLULOID'] = ARGV.map(&:downcase).include?('debug') ? 'true' : 'false'
|
4
5
|
# actor that subscribes to a channel
|
5
6
|
class Subscriber
|
6
7
|
include Celluloid
|
@@ -13,8 +14,13 @@ class Subscriber
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def on_message(message)
|
16
|
-
|
17
|
-
|
17
|
+
if @client.succesfull_subscription?(message)
|
18
|
+
puts "subscriber got successful subscription #{message.inspect}"
|
19
|
+
@client.publish('test_channel2', 'data' => ' subscriber got successfull subscription') # the message needs to be a Hash
|
20
|
+
else
|
21
|
+
puts "subscriber got message #{message.inspect}"
|
22
|
+
@client.publish('test_channel2', 'data' => "subscriber got #{message}") # the message needs to be a Hash
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
def on_close(code, reason)
|
@@ -76,11 +76,12 @@ module CelluloidPubsub
|
|
76
76
|
def parse_options(options)
|
77
77
|
raise 'Options is not a hash ' unless options.is_a?(Hash)
|
78
78
|
@options = options.stringify_keys
|
79
|
-
|
80
|
-
@
|
81
|
-
@
|
82
|
-
@
|
83
|
-
@
|
79
|
+
debug @options if debug_enabled?
|
80
|
+
@backlog = @options.fetch('backlog', 1024)
|
81
|
+
@hostname = @options.fetch('hostname', CelluloidPubsub::WebServer::HOST)
|
82
|
+
@port = @options.fetch('port', CelluloidPubsub::WebServer::PORT)
|
83
|
+
@path = @options.fetch('path', CelluloidPubsub::WebServer::PATH)
|
84
|
+
@spy = @options.fetch('spy', false)
|
84
85
|
end
|
85
86
|
|
86
87
|
# checks if debug is enabled
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid_pubsub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -90,20 +90,20 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 4.
|
93
|
+
version: '4.1'
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4.
|
96
|
+
version: 4.1.0
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 4.
|
103
|
+
version: '4.1'
|
104
104
|
- - '>='
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 4.
|
106
|
+
version: 4.1.0
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: rspec-rails
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|