Polyglot replacement for Ruby WebSocket servers with Action Cable protocol
Clone or download
palkan Refactor configuration (#53)
* Added gRPC specific params
* Support REDIS_URL by default
* Refactor Anycable::Server
  - Use class instance instead of a module
  - Run gRPC server in a thread
  - Remove dependency on global config
* Refactor Anycable::HealthServer
* Add http_health_path configuration parameter
Latest commit e70ece9 Oct 14, 2018

README.md

GitPitch Gem Version Build Status Circle CI Gitter

Anycable

AnyCable allows you to use any WebSocket server (written in any language) as a replacement for your Ruby server (such as Faye, ActionCable, etc).

AnyCable uses ActionCable protocol, so you can use ActionCable JavaScript client without any monkey-patching.

NOTE: Since version 0.4.0 this repository contains only core functionality and cannot be used separately as is. Rails plug-n-play integration has been extracted to anycable-rails gem.

Sponsored by Evil Martians

Requirements

Or you can try to build it from source.

For MacOS there is also the same problem with google-protobuf that can be solved the following way:

# Gemfile
git 'https://github.com/google/protobuf' do
  gem 'google-protobuf'
end

How It Works?

Read our Wiki for more.

Links

Talks

Compatible WebSocket servers

Configuration

Anycable uses anyway_config, thus it is also possible to set configuration variables through secrets.yml or environment vars.

Example with redis sentinel

  rpc_host: "localhost:50123"
  redis_url: "redis://redis-1-1:6379/2"
  redis_sentinels:
    - { host: 'redis-1-1', port: 26379 }
    - { host: 'redis-1-2', port: 26379 }
    - { host: 'redis-1-3', port: 26379 }

ActionCable Compatibility

This is the compatibility list for the AnyCable gem, not for AnyCable servers (which may not support some of the features yet).

Feature Status
Connection Identifiers +
Connection Request (cookies, params) +
Disconnect Handling +
Subscribe to channels +
Parameterized subscriptions +
Unsubscribe from channels +
Subscription Instance Variables -
Performing Channel Actions +
Streaming +
Custom stream callbacks -
Broadcasting +
Custom pubsub adapter Only redis

Build

  • Install required GRPC gems:
gem install grpc
gem install grpc-tools
  • Re-generate GRPC files (if necessary):
make

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/anycable/anycable.

Please, provide reproduction script (using this template) when submitting bugs if possible.

License

The gem is available as open source under the terms of the MIT License.