anycable 1.0.0.preview1 → 1.0.0.preview2
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 +15 -10
- data/MIT-LICENSE +1 -1
- data/README.md +4 -2
- data/lib/anycable/config.rb +24 -10
- data/lib/anycable/rpc_handler.rb +12 -5
- data/lib/anycable/rspec/rpc_stub_context.rb +1 -1
- data/lib/anycable/version.rb +1 -1
- metadata +6 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d002d899e5ef0c6c8e17b131a569dee4e93d948a9a2d401e20c764ee573ae2
|
4
|
+
data.tar.gz: 20743c021aa6c79177cd727d31468b1823ed492c11da1967513fa7cd5bc18f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d8ce6d031bfa1b65e12cbe49a1bb2813267997d090126a09fe55d30dc7e44a62c5315bf3e1f430bb6c8a67909245db2a9e03d3654ac7922cc08d6d09a7c14a
|
7
|
+
data.tar.gz: eb9ecd34150e474fbb8c914d3f0b95e3c23752fe141fc6acf5819fefbaface12d27103bc0a62487d42ec3d76e2228c43f0c3e9b3c34423fc71ce422ad0200131
|
data/CHANGELOG.md
CHANGED
@@ -22,9 +22,13 @@ Now you can access `request` object in channels, too (e.g., to read headers/cook
|
|
22
22
|
|
23
23
|
See [#71](https://github.com/anycable/anycable/pull/71).
|
24
24
|
|
25
|
+
## 0.6.5 (2020-04-01)
|
26
|
+
|
27
|
+
- Relax `anyway_config` dependency. ([@palkan][])
|
28
|
+
|
25
29
|
## 0.6.4 (2020-01-24)
|
26
30
|
|
27
|
-
- Fix Ruby 2.7 warnings. ([@palkan])
|
31
|
+
- Fix Ruby 2.7 warnings. ([@palkan][])
|
28
32
|
|
29
33
|
– Add `REMOTE_ADDR` socket env variable using a synthetic header passed from a websocket
|
30
34
|
server. ([@sponomarev][])
|
@@ -33,7 +37,7 @@ Recreating a request object in your custom connection factory using `Rack::Reque
|
|
33
37
|
`ActionDispatch::Request` (already implemented in [anycable-rails](https://github.com/anycable/anycable-rails))
|
34
38
|
gives you an access to `request.ip` with the properly set IP address.
|
35
39
|
|
36
|
-
- Align socket env to be more
|
40
|
+
- Align socket env to be more compatible with Rack Spec ([@sponomarev][])
|
37
41
|
|
38
42
|
Provide as much env details as possible to be able to reconstruct the full
|
39
43
|
request object in a custom connection factory.
|
@@ -71,7 +75,7 @@ in future versions.
|
|
71
75
|
|
72
76
|
Server is fully managed by the binary itself.
|
73
77
|
|
74
|
-
```
|
78
|
+
```sh
|
75
79
|
# Start anycable daemon
|
76
80
|
$ bundle exec anycabled start
|
77
81
|
|
@@ -129,7 +133,7 @@ You can omit it if you want to load an app form `./config/environment.rb` (e.g.
|
|
129
133
|
AnyCable CLI also allows you to run a separate command (process) from within a RPC server:
|
130
134
|
|
131
135
|
```sh
|
132
|
-
|
136
|
+
bundle exec anycable --server-command "anycable-go -p 3334"
|
133
137
|
```
|
134
138
|
|
135
139
|
#### Configuration
|
@@ -144,6 +148,7 @@ AnyCable.configure do |config|
|
|
144
148
|
# etc
|
145
149
|
end
|
146
150
|
```
|
151
|
+
|
147
152
|
- `REDIS_URL` env is used by default if present (and no `ANYCABLE_REDIS_URL` specified)
|
148
153
|
- Make HTTP health check url configurable
|
149
154
|
- Add ability to pass Redis Sentinel config as array of string.
|
@@ -184,7 +189,6 @@ end
|
|
184
189
|
|
185
190
|
- `AnyCable::Server.start` is deprecated
|
186
191
|
|
187
|
-
|
188
192
|
## 0.5.2 (2018-09-06)
|
189
193
|
|
190
194
|
- [#48](https://github.com/anycable/anycable/pull/48) Add HTTP health server ([@DarthSim][])
|
@@ -205,9 +209,9 @@ Previously we hardcoded only "Cookie" header. Now we add all passed headers by W
|
|
205
209
|
|
206
210
|
Now RPC responses has 3 statuses:
|
207
211
|
|
208
|
-
|
209
|
-
|
210
|
-
|
212
|
+
1) `SUCCESS` – successful request, operation succeed
|
213
|
+
2) `FAILURE` – successful request, operation failed (e.g. authentication failed)
|
214
|
+
3) `ERROR` – request failed (exception raised).
|
211
215
|
|
212
216
|
We provide `error_msg` only when request status is `ERROR`.
|
213
217
|
|
@@ -252,7 +256,7 @@ Add `Socket#subscribe`, `unsubscribe` and `unsubscribe_from_all` methods.
|
|
252
256
|
|
253
257
|
- Make commands handling more abstract. ([@palkan][])
|
254
258
|
|
255
|
-
We now do not explicitly call channels action but use the only one
|
259
|
+
We now do not explicitly call channels action but use the only one entrypoint for all commands:
|
256
260
|
|
257
261
|
```ruby
|
258
262
|
connection.handle_channel_command(identifier, command, data)
|
@@ -268,7 +272,7 @@ Replace `Subscribe`, `Unsubscribe` and `Perform` methods with `Command` method.
|
|
268
272
|
|
269
273
|
- Extract Rails functionality to separate gem. ([@palkan][])
|
270
274
|
|
271
|
-
All Rails specifics now live here https://github.com/anycable/anycable-rails.
|
275
|
+
All Rails specifics now live here [https://github.com/anycable/anycable-rails](https://github.com/anycable/anycable-rails).
|
272
276
|
|
273
277
|
## 0.3.0 (2016-12-28)
|
274
278
|
|
@@ -281,3 +285,4 @@ Implement `Disconnect` handler, which invokes `Connection#disconnect` (along wit
|
|
281
285
|
[@accessd]: https://github.com/accessd
|
282
286
|
[@DarthSim]: https://github.com/DarthSim
|
283
287
|
[@sponomarev]: https://github.com/sponomarev
|
288
|
+
[@bibendi]: https://github.com/bibendi
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
[](https://gitpitch.com/anycable/anycable/master?grs=github)
|
1
|
+
[](https://gitpitch.com/anycable/anycable/master?grs=github)
|
2
|
+
[](https://rubygems.org/gems/anycable)
|
3
|
+
[](https://github.com/anycable/anycable/actions)
|
2
4
|
[](https://gitter.im/anycable/Lobby)
|
3
5
|
[](https://docs.anycable.io)
|
4
6
|
|
@@ -75,4 +77,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
75
77
|
|
76
78
|
## Security Contact
|
77
79
|
|
78
|
-
To report a security vulnerability, please
|
80
|
+
To report a security vulnerability, please contact us at `anycable@evilmartians.com`. We will coordinate the fix and disclosure.
|
data/lib/anycable/config.rb
CHANGED
@@ -43,19 +43,33 @@ module AnyCable
|
|
43
43
|
ignore_options :rpc_server_args
|
44
44
|
flag_options :log_grpc, :debug
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
# Support both anyway_config 1.4 and 2.0.
|
47
|
+
# DEPRECATE: Drop <2.0 support in 1.1
|
48
|
+
if respond_to?(:on_load)
|
49
|
+
on_load { self.debug = debug != false }
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
def log_level
|
52
|
+
debug? ? :debug : super
|
53
|
+
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
55
|
+
def log_grpc
|
56
|
+
debug? || super
|
57
|
+
end
|
58
|
+
else
|
59
|
+
def log_level
|
60
|
+
debug ? :debug : @log_level
|
61
|
+
end
|
57
62
|
|
58
|
-
|
63
|
+
def log_grpc
|
64
|
+
debug || @log_grpc
|
65
|
+
end
|
66
|
+
|
67
|
+
def debug
|
68
|
+
@debug != false
|
69
|
+
end
|
70
|
+
|
71
|
+
alias debug? debug
|
72
|
+
end
|
59
73
|
|
60
74
|
def http_health_port_provided?
|
61
75
|
!http_health_port.nil? && http_health_port != ""
|
data/lib/anycable/rpc_handler.rb
CHANGED
@@ -106,17 +106,17 @@ module AnyCable
|
|
106
106
|
uri = URI.parse(request_env.url)
|
107
107
|
|
108
108
|
env = base_rack_env
|
109
|
-
env.merge!(
|
109
|
+
env.merge!({
|
110
110
|
"PATH_INFO" => uri.path,
|
111
111
|
"QUERY_STRING" => uri.query,
|
112
112
|
"SERVER_NAME" => uri.host,
|
113
|
-
"SERVER_PORT" => uri.port
|
113
|
+
"SERVER_PORT" => uri.port,
|
114
114
|
"HTTP_HOST" => uri.host,
|
115
115
|
"REMOTE_ADDR" => request_env.headers.delete("REMOTE_ADDR"),
|
116
|
-
"rack.url_scheme" => uri.scheme,
|
116
|
+
"rack.url_scheme" => uri.scheme&.sub(/^ws/, "http"),
|
117
117
|
# AnyCable specific fields
|
118
118
|
"anycable.raw_cstate" => request_env.cstate&.to_h
|
119
|
-
)
|
119
|
+
}.delete_if { |_k, v| v.nil? })
|
120
120
|
|
121
121
|
env.merge!(build_headers(request_env.headers))
|
122
122
|
end
|
@@ -125,6 +125,7 @@ module AnyCable
|
|
125
125
|
# Minimum required variables according to Rack Spec
|
126
126
|
# (not all of them though, just those enough for Action Cable to work)
|
127
127
|
# See https://rubydoc.info/github/rack/rack/master/file/SPEC
|
128
|
+
# and https://github.com/rack/rack/blob/master/lib/rack/lint.rb
|
128
129
|
{
|
129
130
|
"REQUEST_METHOD" => "GET",
|
130
131
|
"SCRIPT_NAME" => "",
|
@@ -133,7 +134,13 @@ module AnyCable
|
|
133
134
|
"SERVER_NAME" => "",
|
134
135
|
"SERVER_PORT" => "80",
|
135
136
|
"rack.url_scheme" => "http",
|
136
|
-
"rack.input" => ""
|
137
|
+
"rack.input" => StringIO.new("", "r").tap { |io| io.set_encoding(Encoding::ASCII_8BIT) },
|
138
|
+
"rack.version" => Rack::VERSION,
|
139
|
+
"rack.errors" => StringIO.new("").tap { |io| io.set_encoding(Encoding::ASCII_8BIT) },
|
140
|
+
"rack.multithread" => true,
|
141
|
+
"rack.multiprocess" => false,
|
142
|
+
"rack.run_once" => false,
|
143
|
+
"rack.hijack?" => false
|
137
144
|
}
|
138
145
|
end
|
139
146
|
|
data/lib/anycable/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.preview2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.4.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.4.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '13.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '13.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,48 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3.5'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-md
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.3'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.3'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: simplecov
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 0.3.8
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 0.3.8
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: standard
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 0.1.7
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 0.1.7
|
153
111
|
description: AnyCable is a polyglot replacement for ActionCable-compatible servers
|
154
112
|
email:
|
155
113
|
- dementiev.vm@gmail.com
|