async-websocket 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/websocket/adapters/rails.rb +44 -0
- data/lib/async/websocket/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e97832ebcebab09dfd5a042aad8532a7a5277cf6609fecae9f73a1826cac7d
|
4
|
+
data.tar.gz: 671da6e463ced51447b8cb49aabbb8b51d644a19adc655e9f955fe4b6772afd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c33efe4ce32ddf75596defe2b3c3f56bb05973d1c13e4b9c39e9fbaed604c9774271b6dd88db11691ba1a498b3c3ee807e6aa3a54447a30ea3ba791d8818388b
|
7
|
+
data.tar.gz: 50b6419551ee9643771cb80dbd7ad48460e265f3e8a168e60f4afa9557802eb4bc2543b5cb678e55b81ccf006679bfa865047e590f5f7b99526f0dd628bc3005
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
#
|
3
|
+
# Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative 'rack'
|
24
|
+
|
25
|
+
module Async
|
26
|
+
module WebSocket
|
27
|
+
module Adapters
|
28
|
+
module Rails
|
29
|
+
def self.open(request, **options, &block)
|
30
|
+
if response = Rack.open(request.env, **options, &block)
|
31
|
+
response[1]['rack.hijack'] = lambda do |stream|
|
32
|
+
response[2].call(stream)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Close the response to prevent Rails from... trying to render a view?
|
36
|
+
return ::ActionDispatch::Response.new(response[0], response[1], nil).tap(&:close)
|
37
|
+
end
|
38
|
+
|
39
|
+
return ::ActionDispatch::Response.new(404, [], [])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-websocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|
@@ -144,6 +144,7 @@ extra_rdoc_files: []
|
|
144
144
|
files:
|
145
145
|
- lib/async/websocket.rb
|
146
146
|
- lib/async/websocket/adapters/rack.rb
|
147
|
+
- lib/async/websocket/adapters/rails.rb
|
147
148
|
- lib/async/websocket/client.rb
|
148
149
|
- lib/async/websocket/connect_request.rb
|
149
150
|
- lib/async/websocket/connect_response.rb
|