async-websocket 0.17.0 → 0.18.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2b2cae182fcc4c6dbfd9724236afc25472d930a98be9496b4bc2af6f67ad502
4
- data.tar.gz: a9bb7c63e69247a287bd512973788d0e807b6464835ebef1f5d5d1c407574327
3
+ metadata.gz: 54e97832ebcebab09dfd5a042aad8532a7a5277cf6609fecae9f73a1826cac7d
4
+ data.tar.gz: 671da6e463ced51447b8cb49aabbb8b51d644a19adc655e9f955fe4b6772afd4
5
5
  SHA512:
6
- metadata.gz: e0f1f16a9e9fecfa3b68eec6c3b18b63588477ef3b4d2049d42a017e9f35073c6b54641585db4cbebaeff53a37537c742130354ee604620c68c79b24980d6bdf
7
- data.tar.gz: 2b43de05bcffc2089345160f21e853bba156430b183ce8b0268ca229c0903f11b723849bcec6d8117271580d9265b2ac0999aacd7be9d336987401ec09c179ba
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
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module WebSocket
23
- VERSION = "0.17.0"
23
+ VERSION = "0.18.0"
24
24
  end
25
25
  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.17.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-02-13 00:00:00.000000000 Z
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