drb-websocket 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/drb/websocket/rack_app.rb +19 -0
- data/lib/drb/websocket/server.rb +8 -0
- data/lib/drb/websocket/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09245285a4bf2d658f2557a741ed7181382ce7a3'
|
4
|
+
data.tar.gz: 152a31071adcade6e234522d0030bb16c0896060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fd1c8e41edf0584f091b3d5f3f8bd47b9ab75c62a815558273f79b734c1731747491115227e951e08452cbb18432ebd11f652f50cfc713cc050939cc04f7f0f
|
7
|
+
data.tar.gz: 9f4049e8f560f5a45101c80998b81eccce9d30f88d7b3ef4acbb3f5db1691455cf2bf683cdda86ee93108df6b3d61c4b1b4d001e8e975f358f84c731c04283bb
|
@@ -3,6 +3,7 @@ module DRb
|
|
3
3
|
class RackApp
|
4
4
|
def initialize(app)
|
5
5
|
@app = app
|
6
|
+
RackApp.config.use_rack = true
|
6
7
|
end
|
7
8
|
|
8
9
|
@servers = {}
|
@@ -50,6 +51,24 @@ module DRb
|
|
50
51
|
@app.call(env)
|
51
52
|
end
|
52
53
|
end
|
54
|
+
|
55
|
+
def self.config
|
56
|
+
@config ||= Config.new
|
57
|
+
yield @config if block_given?
|
58
|
+
@config
|
59
|
+
end
|
60
|
+
|
61
|
+
class Config
|
62
|
+
attr_reader :standalone
|
63
|
+
|
64
|
+
def initialize
|
65
|
+
@standalone = true
|
66
|
+
end
|
67
|
+
|
68
|
+
def use_rack=(flag)
|
69
|
+
@standalone = !flag
|
70
|
+
end
|
71
|
+
end
|
53
72
|
end
|
54
73
|
end
|
55
74
|
end
|
data/lib/drb/websocket/server.rb
CHANGED
@@ -52,6 +52,14 @@ module DRb
|
|
52
52
|
|
53
53
|
u = URI.parse(uri)
|
54
54
|
RackApp.register("#{u.host}:#{u.port}", self)
|
55
|
+
|
56
|
+
if RackApp.config.standalone
|
57
|
+
Thread.new do
|
58
|
+
app = RackApp.new(-> { [400, {}, []] })
|
59
|
+
thin = Rack::Handler.get('thin')
|
60
|
+
thin.run(app, Host: u.host, Port: u.port)
|
61
|
+
end.run
|
62
|
+
end
|
55
63
|
end
|
56
64
|
|
57
65
|
def close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drb-websocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faye-websocket
|