AnyCable allows you to use any WebSocket server (written in any language) as a replacement for built-in Ruby ActionCable server.
With AnyCable you can use channels, client-side JS, broadcasting - (almost) all that you can do with ActionCable.
You can even use ActionCable in development and not be afraid of compatibility issues.
NOTE: MacOS users, please, beware of Sierra-related bug.
- Ruby ~> 2.3;
- Rails ~> 5.0;
- Redis
Add Anycable to your application's Gemfile:
gem 'anycable', group: :production
And then run:
rails generate anycable
to create executable.
You can use built-in ActionCable for test and development.
Add config/anycable.yml
if you want to override defaults (see below):
production:
# gRPC server host
rpc_host: "localhost:50051"
# Redis URL (for broadcasting)
redis_url: "redis://localhost:6379/2"
# Redis channel name
redis_channel: "anycable"
Anycable uses anyway_config, thus it is also possible to set configuration variables through secrets.yml
or environment vars.
Run Anycable server:
./bin/anycable
Feature | Status |
---|---|
Connection Identifiers | + |
Connection Request (cookies, params) | + |
Disconnect Handling | coming soon |
Subscribe to channels | + |
Parameterized subscriptions | coming soon |
Unsubscribe from channels | + |
Subscription Instance Variables | - |
Performing Channel Actions | + |
Streaming | + |
Custom stream callbacks | - |
Broadcasting | + |
Bug reports and pull requests are welcome on GitHub at https://github.com/anycable/anycable.
The gem is available as open source under the terms of the MIT License.