anycable 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +7 -2
- data/lib/anycable/broadcast_adapters.rb +1 -1
- data/lib/anycable/health_server.rb +2 -2
- data/lib/anycable/rpc_handler.rb +31 -11
- data/lib/anycable/server.rb +1 -1
- data/lib/anycable/version.rb +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b624b0695335efdb861cfdb90b16caa0b2ddd67698a0ac813a81e9ae98a52eb
|
4
|
+
data.tar.gz: b70e2b622120da3ae2df10049e6145d958d84d78ab8a080943a8e50aab4cf983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97619fd72a53a84608f47b9a99504b080731a0b8915667007d9cf3240feda2a880b0cdcb67acddefec14c34fbbd169c812a4dc310ef4d0b3757c818471ae019c
|
7
|
+
data.tar.gz: efb598ebbd08e0de7574f0de3690b0c7caf11812f3b2afcde26aee5c8bff8a4607cd3a9b791cc978df458d00c37155d23d520118ffc38af98f1e7c9e66760d88
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.6.4 (2020-01-24)
|
6
|
+
|
7
|
+
- Fix Ruby 2.7 warnings. ([@palkan])
|
8
|
+
|
9
|
+
– Add `REMOTE_ADDR` socket env variable using a synthetic header passed from a websocket
|
10
|
+
server. ([@sponomarev][])
|
11
|
+
|
12
|
+
Recreating a request object in your custom connection factory using `Rack::Request` or
|
13
|
+
`ActionDispatch::Request` (already implemented in [anycable-rails](https://github.com/anycable/anycable-rails))
|
14
|
+
gives you an access to `request.ip` with the properly set IP address.
|
15
|
+
|
16
|
+
- Align socket env to be more compatibile with Rack Spec ([@sponomarev][])
|
17
|
+
|
18
|
+
Provide as much env details as possible to be able to reconstruct the full
|
19
|
+
request object in a custom connection factory.
|
20
|
+
|
5
21
|
## 0.6.3 (2019-03-26)
|
6
22
|
|
7
23
|
- Relax `redis` gem version requirement. ([@palkan][])
|
@@ -244,3 +260,4 @@ Implement `Disconnect` handler, which invokes `Connection#disconnect` (along wit
|
|
244
260
|
[@sadovnik]: https://github.com/sadovnik
|
245
261
|
[@accessd]: https://github.com/accessd
|
246
262
|
[@DarthSim]: https://github.com/DarthSim
|
263
|
+
[@sponomarev]: https://github.com/sponomarev
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
AnyCable allows you to use any WebSocket server (written in any language) as a replacement for your Ruby server (such as Faye, ActionCable, etc).
|
11
11
|
|
12
|
-
AnyCable uses
|
12
|
+
AnyCable uses the same protocol as ActionCable, so you can use its [JavaScript client](https://www.npmjs.com/package/actioncable) without any monkey-patching.
|
13
13
|
|
14
14
|
<a href="https://evilmartians.com/">
|
15
15
|
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
|
@@ -17,7 +17,7 @@ AnyCable uses ActionCable protocol, so you can use ActionCable [JavaScript clien
|
|
17
17
|
## Requirements
|
18
18
|
|
19
19
|
- Ruby >= 2.4
|
20
|
-
- Redis (for
|
20
|
+
- Redis (for broadcasting, [discuss other options](https://github.com/anycable/anycable/issues/2) with us!)
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
@@ -71,3 +71,8 @@ Please, provide reproduction script (using [this template](https://github.com/an
|
|
71
71
|
|
72
72
|
## License
|
73
73
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
74
|
+
|
75
|
+
## Security Contact
|
76
|
+
|
77
|
+
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
78
|
+
|
@@ -26,7 +26,7 @@ module AnyCable
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
BroadcastAdapters.const_get(adapter_class_name, false).new(options || {})
|
29
|
+
BroadcastAdapters.const_get(adapter_class_name, false).new(**(options || {}))
|
30
30
|
end
|
31
31
|
# rubocop: enable Metrics/AbcSize, Metrics/MethodLength
|
32
32
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "webrick"
|
4
|
-
|
5
3
|
module AnyCable
|
6
4
|
# Server for HTTP healthchecks.
|
7
5
|
#
|
@@ -53,6 +51,8 @@ module AnyCable
|
|
53
51
|
attr_reader :logger
|
54
52
|
|
55
53
|
def build_server
|
54
|
+
require "webrick"
|
55
|
+
|
56
56
|
WEBrick::HTTPServer.new(
|
57
57
|
Port: port,
|
58
58
|
Logger: logger,
|
data/lib/anycable/rpc_handler.rb
CHANGED
@@ -66,7 +66,9 @@ module AnyCable
|
|
66
66
|
def command(message, _unused_call)
|
67
67
|
logger.debug("RPC Command: #{message.inspect}")
|
68
68
|
|
69
|
-
|
69
|
+
# We don't have path/headers information here,
|
70
|
+
# but we still want `connection.env` to work
|
71
|
+
socket = build_socket(env: base_rack_env)
|
70
72
|
|
71
73
|
connection = factory.call(
|
72
74
|
socket,
|
@@ -97,24 +99,42 @@ module AnyCable
|
|
97
99
|
|
98
100
|
private
|
99
101
|
|
100
|
-
# Build env from
|
102
|
+
# Build Rack env from request
|
101
103
|
def rack_env(request)
|
102
104
|
uri = URI.parse(request.path)
|
103
|
-
|
104
|
-
|
105
|
-
|
105
|
+
|
106
|
+
env = base_rack_env
|
107
|
+
env.merge!(
|
106
108
|
"PATH_INFO" => uri.path,
|
109
|
+
"QUERY_STRING" => uri.query,
|
110
|
+
"SERVER_NAME" => uri.host,
|
107
111
|
"SERVER_PORT" => uri.port.to_s,
|
108
112
|
"HTTP_HOST" => uri.host,
|
109
|
-
|
110
|
-
"rack.
|
111
|
-
|
112
|
-
|
113
|
-
|
113
|
+
"REMOTE_ADDR" => request.headers.delete("REMOTE_ADDR"),
|
114
|
+
"rack.url_scheme" => uri.scheme
|
115
|
+
)
|
116
|
+
|
117
|
+
env.merge!(build_headers(request.headers))
|
118
|
+
end
|
119
|
+
|
120
|
+
def base_rack_env
|
121
|
+
# Minimum required variables according to Rack Spec
|
122
|
+
# (not all of them though, just those enough for Action Cable to work)
|
123
|
+
# See https://rubydoc.info/github/rack/rack/master/file/SPEC
|
124
|
+
{
|
125
|
+
"REQUEST_METHOD" => "GET",
|
126
|
+
"SCRIPT_NAME" => "",
|
127
|
+
"PATH_INFO" => "/",
|
128
|
+
"QUERY_STRING" => "",
|
129
|
+
"SERVER_NAME" => "",
|
130
|
+
"SERVER_PORT" => "80",
|
131
|
+
"rack.url_scheme" => "http",
|
132
|
+
"rack.input" => ""
|
133
|
+
}
|
114
134
|
end
|
115
135
|
|
116
136
|
def build_socket(**options)
|
117
|
-
AnyCable::Socket.new(options)
|
137
|
+
AnyCable::Socket.new(**options)
|
118
138
|
end
|
119
139
|
|
120
140
|
def build_headers(headers)
|
data/lib/anycable/server.rb
CHANGED
@@ -117,7 +117,7 @@ module AnyCable
|
|
117
117
|
attr_reader :logger, :start_thread
|
118
118
|
|
119
119
|
def build_server(options)
|
120
|
-
GRPC::RpcServer.new(options).tap do |server|
|
120
|
+
GRPC::RpcServer.new(**options).tap do |server|
|
121
121
|
server.add_http2_port(host, :this_port_is_insecure)
|
122
122
|
server.handle(AnyCable::RPCHandler)
|
123
123
|
server.handle(build_health_checker)
|
data/lib/anycable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.68.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.68.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,7 +184,12 @@ files:
|
|
184
184
|
homepage: http://github.com/anycable/anycable
|
185
185
|
licenses:
|
186
186
|
- MIT
|
187
|
-
metadata:
|
187
|
+
metadata:
|
188
|
+
bug_tracker_uri: http://github.com/anycable/anycable/issues
|
189
|
+
changelog_uri: https://github.com/anycable/anycable/blob/master/CHANGELOG.md
|
190
|
+
documentation_uri: https://docs.anycable.io/
|
191
|
+
homepage_uri: https://anycable.io/
|
192
|
+
source_code_uri: http://github.com/anycable/anycable
|
188
193
|
post_install_message:
|
189
194
|
rdoc_options: []
|
190
195
|
require_paths:
|
@@ -200,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
205
|
- !ruby/object:Gem::Version
|
201
206
|
version: '0'
|
202
207
|
requirements: []
|
203
|
-
rubygems_version: 3.0.
|
208
|
+
rubygems_version: 3.0.3
|
204
209
|
signing_key:
|
205
210
|
specification_version: 4
|
206
211
|
summary: AnyCable is a polyglot replacement for ActionCable-compatible servers
|