Ref: https://github.com/anycable/anycable/releases/tag/v0.6.0
RubyConf 2018 special.
tl;dr anycable
CLI; redis
gem is no longer a runtime dependency (but still required for Redis broadcast adapter); health checkers; middlewares support and more flexible configuration.
📝 Check out a new documentation website.
AnyCable now ships with a CLI–anycable
.
Use it to run a gRPC server:
# run anycable and load app from app.rb
bundle exec anycable -r app.rb
# or
bundle exec anycable --require app.rb
All configuration options are also supported as CLI options (see anycable -h
for more information).
The only required options is the application file to load (-r/--require
).
You can omit it if you want to load an app form ./config/environment.rb
(e.g. with Rails) or ./config/anycable.rb
.
AnyCable CLI also allows you to run a separate command (process) from within a RPC server:
$ bundle exec anycable --server-command "anycable-go -p 3334"
- Default server host is changed from
localhost:50051
to0.0.0.0:50051
- Expose gRPC server parameters via
rpc_*
config params:
AnyCable.configure do |config|
config.rpc_pool_size = 120
config.rpc_max_waiting_requests = 10
# etc
end
REDIS_URL
env is used by default if present (and noANYCABLE_REDIS_URL
specified)- Make HTTP health check url configurable
- Add ability to pass Redis Sentinel config as array of string.
Now it's possible to pass Sentinel configuration via env vars:
ANYCABLE_REDIS_SENTINELS=127.0.0.1:26380,127.0.0.1:26381 bundle exec anycable
AnyCable allows you to use custom broadcasting adapters (Redis is used by default):
# Specify by name (tries to load `AnyCable::BroadcastAdapters::MyAdapter` from
# "anycable/broadcast_adapters/my_adapter")
AnyCable.broadcast_adapter = :my_adapter, { option: "value" }
# or provide an instance (should respond_to #broadcast)
AnyCable.broadcast_adapter = MyAdapter.new
Breaking: to use Redis adapter you must ensure that it is present in your Gemfile; AnyCable gem doesn't have redis
as a dependency anymore.
- Added middlewares support
See docs.
- Added gRPC health checker.
See docs.
NOTE: the old API is still working but deprecated (you'll see a notice).
-
Use
AnyCable
instead ofAnycable
-
New API for registering error handlers:
AnyCable.capture_exception do |ex|
Honeybadger.notify(ex)
end
AnyCable::Server.start
is deprecated and will be removed in the next version