anycable-core 1.5.0.rc.1 → 1.5.1
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/anycable/grpc/config.rb +9 -1
- data/lib/anycable/httrpc/server.rb +3 -2
- data/lib/anycable/socket.rb +23 -2
- data/lib/anycable/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e580fb7244e7eb0d8ad4d749ec3eaec19e5490152c39c1f30f42b53249185536
|
4
|
+
data.tar.gz: 7da10692cea6e5d1d9ced38075c649077eed8ed5a5c49cdaac446cb7dbe686ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196239a321ae0f634b2cbe61b81d83e454b3be116b0748ca80b07405ecc1e333258735b9195f7e6b927c30dc0677101805f0dbad267b15beb96b17ca20823b7a
|
7
|
+
data.tar.gz: 6430837a566150c68611488d82ccf1e0955953f1ef4ecf32df3b00ace5c255dc5755f051e4ee3fb3ab18d0c286e1e214ec759b6fc4fea6a698e34a51e80ad03c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.5.1 (2024-06-14) 🇪🇺 ⚽️
|
6
|
+
|
7
|
+
- Fixed compatibility with Rack 3.1 ([@earlopain][])
|
8
|
+
|
9
|
+
## 1.5.0 (2024-04-01)
|
10
|
+
|
11
|
+
- Fixed gRPC keepalive settings to align with the Go server client. ([@palkan][])
|
12
|
+
|
5
13
|
- Added JWT utils. ([@palkan][])
|
6
14
|
|
7
15
|
You can now generate and verify AnyCable JWT tokens without using additional dependencies:
|
@@ -207,3 +215,4 @@ See [Changelog](https://github.com/anycable/anycable/blob/0-6-stable/CHANGELOG.m
|
|
207
215
|
[@smasry]: https://github.com/smasry
|
208
216
|
[@Envek]: https://github.com/Envek
|
209
217
|
[@cylon-v]: https://github.com/cylon-v
|
218
|
+
[@earlopain]: https://github.com/earlopain
|
data/lib/anycable/grpc/config.rb
CHANGED
@@ -35,7 +35,15 @@ module AnyCable
|
|
35
35
|
poll_period: rpc_poll_period,
|
36
36
|
pool_keep_alive: rpc_pool_keep_alive,
|
37
37
|
tls_credentials: tls_credentials,
|
38
|
-
server_args: enhance_grpc_server_args(normalized_grpc_server_args)
|
38
|
+
server_args: enhance_grpc_server_args(normalized_grpc_server_args).tap do |sargs|
|
39
|
+
# Provide keepalive defaults unless explicitly set.
|
40
|
+
# They must MATCH the corresponding Go client defaults:
|
41
|
+
# https://github.com/anycable/anycable-go/blob/62e77e7f759aa9253c2bd23812dd59ec8471db86/rpc/rpc.go#L512-L515
|
42
|
+
#
|
43
|
+
# See also https://github.com/grpc/grpc/blob/master/doc/keepalive.md and https://grpc.github.io/grpc/core/group__grpc__arg__keys.html
|
44
|
+
sargs["grpc.keepalive_permit_without_calls"] ||= 1
|
45
|
+
sargs["grpc.http2.min_recv_ping_interval_without_data_ms"] ||= 10_000
|
46
|
+
end
|
39
47
|
}
|
40
48
|
end
|
41
49
|
|
@@ -27,8 +27,9 @@ module AnyCable
|
|
27
27
|
return [404, {}, ["Not found"]] unless AnyCable.rpc_handler.supported?(rpc_command)
|
28
28
|
|
29
29
|
# read request body and it's empty, return 422
|
30
|
-
|
31
|
-
|
30
|
+
# rack.input is optional starting in Rack 3.1
|
31
|
+
request_body = env["rack.input"]&.read
|
32
|
+
return [422, {}, ["Empty request body"]] if request_body.nil? || request_body.empty?
|
32
33
|
|
33
34
|
payload =
|
34
35
|
case rpc_command
|
data/lib/anycable/socket.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module AnyCable
|
4
|
+
WHISPER_KEY = "$w"
|
5
|
+
|
4
6
|
# Socket mock to be used with application connection
|
5
7
|
class Socket
|
6
8
|
# Represents the per-connection store
|
@@ -59,10 +61,21 @@ module AnyCable
|
|
59
61
|
|
60
62
|
def unsubscribe(_channel, broadcasting)
|
61
63
|
streams[:stop] << broadcasting
|
64
|
+
|
65
|
+
if istate.read(WHISPER_KEY) == broadcasting
|
66
|
+
istate.write(WHISPER_KEY, "")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def whisper(_channel, broadcasting)
|
71
|
+
istate.write(WHISPER_KEY, broadcasting)
|
62
72
|
end
|
63
73
|
|
64
74
|
def unsubscribe_from_all(_channel)
|
65
75
|
@stop_all_streams = true
|
76
|
+
if istate.read(WHISPER_KEY)
|
77
|
+
istate.write(WHISPER_KEY, "")
|
78
|
+
end
|
66
79
|
end
|
67
80
|
|
68
81
|
def streams
|
@@ -141,22 +154,30 @@ module AnyCable
|
|
141
154
|
# (not all of them though, just those enough for Action Cable to work)
|
142
155
|
# See https://rubydoc.info/github/rack/rack/master/file/SPEC
|
143
156
|
# and https://github.com/rack/rack/blob/master/lib/rack/lint.rb
|
144
|
-
{
|
157
|
+
env = {
|
145
158
|
"REQUEST_METHOD" => "GET",
|
146
159
|
"SCRIPT_NAME" => "",
|
147
160
|
"PATH_INFO" => "/",
|
148
161
|
"QUERY_STRING" => "",
|
149
162
|
"SERVER_NAME" => "",
|
150
163
|
"SERVER_PORT" => "80",
|
164
|
+
"SERVER_PROTOCOL" => "HTTP/1.1",
|
151
165
|
"rack.url_scheme" => "http",
|
152
166
|
"rack.input" => StringIO.new("", "r").tap { |io| io.set_encoding(Encoding::ASCII_8BIT) },
|
153
|
-
"rack.version" => ::Rack::VERSION,
|
154
167
|
"rack.errors" => StringIO.new("").tap { |io| io.set_encoding(Encoding::ASCII_8BIT) },
|
155
168
|
"rack.multithread" => true,
|
156
169
|
"rack.multiprocess" => false,
|
157
170
|
"rack.run_once" => false,
|
158
171
|
"rack.hijack?" => false
|
159
172
|
}
|
173
|
+
|
174
|
+
# Rack 3.1 removes `Rack::VERSION`. rack.version is optional (deprecated) since Rack 3.0
|
175
|
+
if ::Rack::RELEASE < "3.0"
|
176
|
+
rversion = ::Rack::VERSION
|
177
|
+
# @type var rversion : String
|
178
|
+
env["rack.version"] = rversion
|
179
|
+
end
|
180
|
+
env
|
160
181
|
end
|
161
182
|
|
162
183
|
def build_headers(headers)
|
data/lib/anycable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: google-protobuf
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
33
|
+
version: '3.25'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
40
|
+
version: '3.25'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: redis
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,7 +277,7 @@ metadata:
|
|
277
277
|
homepage_uri: https://anycable.io/
|
278
278
|
source_code_uri: http://github.com/anycable/anycable
|
279
279
|
funding_uri: https://github.com/sponsors/anycable
|
280
|
-
post_install_message:
|
280
|
+
post_install_message:
|
281
281
|
rdoc_options: []
|
282
282
|
require_paths:
|
283
283
|
- lib
|
@@ -288,12 +288,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
288
288
|
version: 2.7.0
|
289
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
290
290
|
requirements:
|
291
|
-
- - "
|
291
|
+
- - ">="
|
292
292
|
- !ruby/object:Gem::Version
|
293
|
-
version:
|
293
|
+
version: '0'
|
294
294
|
requirements: []
|
295
|
-
rubygems_version: 3.4.
|
296
|
-
signing_key:
|
295
|
+
rubygems_version: 3.4.19
|
296
|
+
signing_key:
|
297
297
|
specification_version: 4
|
298
298
|
summary: AnyCable core RPC implementation
|
299
299
|
test_files: []
|