• Stars
    star
    470
  • Rank 89,915 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AnyCable for Ruby on Rails applications

Gem Version Build Documentation

AnyCable Rails

AnyCable allows you to use any WebSocket server (written in any language) as a replacement for built-in Rails Action Cable server.

With AnyCable you can use channels, client-side JS, broadcasting - (almost) all that you can do with Action Cable.

You can even use Action Cable in development and not be afraid of compatibility issues.

💾 Example Application

📑 Documentation.

AnyCable Pro has been launched 🚀

Sponsored by Evil Martians

Requirements

  • Ruby >= 2.6
  • Rails >= 6.0 (Rails 5.1 could work but we're no longer enforce compatibility on CI)
  • Redis (see other options for broadcasting)

Usage

Add anycable-rails gem to your Gemfile:

gem "anycable-rails"

# when using Redis broadcast adapter
gem "redis", ">= 4.0"

Interactive set up

After the gem was installed, you can run an interactive wizard to configure your Rails application for using with AnyCable by running a generator:

bundle exec rails g anycable:setup

Manual set up

Specify AnyCable subscription adapter for Action Cable:

# config/cable.yml
development:
  adapter: any_cable # or anycable

production:
  adapter: any_cable

and specify AnyCable WebSocket server URL:

# For development it's likely the localhost

# config/environments/development.rb
config.action_cable.url = "ws://localhost:8080/cable"

# For production it's likely to have a sub-domain and secure connection

# config/environments/production.rb
config.action_cable.url = "wss://ws.example.com/cable"

Then, run AnyCable RPC server:

$ bundle exec anycable

# don't forget to provide Rails env

$ RAILS_ENV=production bundle exec anycable

And, finally, run AnyCable WebSocket server, e.g. anycable-go:

anycable-go --host=localhost --port=8080

See documentation for more information on AnyCable + Rails usage.

Action Cable Compatibility

See documentation.

Contributing

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

License

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

Security Contact

To report a security vulnerability, please contact us at [email protected]. We will coordinate the fix and disclosure.

More Repositories

1

anycable

AnyCable for Ruby applications
Ruby
1,857
star
2

anycable-go

AnyCable real-time server
Go
348
star
3

anycable_rails_demo

AnyCable Rails demo application and its different variations
Ruby
209
star
4

graphql-anycable

A drop-in replacement for GraphQL ActionCable subscriptions. Works with AnyCable.
Ruby
108
star
5

anycable-client

AnyCable / Action Cable JavaScript client for web, Node.js & React Native
TypeScript
75
star
6

anycable_demo

Anycable demo application
Ruby
53
star
7

erlycable

Anycable Erlang WebSocket server
Erlang
45
star
8

anycable-rack-server

AnyCable-compatible Ruby Rack middleware
Ruby
24
star
9

xk6-cable

A k6 extension for testing Action Cable and AnyCable functionality
Go
23
star
10

heroku-anycable-go

Heroku buildpack for bundling Anycable-Go
Shell
18
star
11

anycable-helm

Helm charts for installing any cables into a Kubernetes cluster
Mustache
15
star
12

anycable-twilio-hanami-demo

Using AnyCable and Hanami to build an app to process Twilio Media streams
Go
12
star
13

websocket-bench

CLI interface for benchmark AnyCable
Go
10
star
14

anyt

AnyCable conformance testing tool
Ruby
10
star
15

docs.anycable.io

AnyCable documentation
Ruby
9
star
16

vercel-anycable-demo

Next.js real-time application using AnyCable-Go as a real-time server and deployed on Vercel
TypeScript
8
star
17

anycable-serverless-js

AnyCable channels API for serverless
TypeScript
7
star
18

action-cable-redis-backport

Ruby
7
star
19

capistrano-anycable

AnyCable integration for Capistrano
Ruby
7
star
20

anycable-rails-jwt

JWT identification helpers for AnyCable
Ruby
5
star
21

anycable-web

AnyCable web page
SCSS
5
star
22

anycable-go-scaffold

Template repository for anycable-go based applications
Go
3
star
23

anycable.github.io

AnyCable website contents
HTML
3
star
24

github-actions

Reusable Github Actions for AnyCable projects
2
star
25

homebrew-anycable

Anycable homebrew formulae
2
star
26

kuby-anycable

Kuby plugin to deploy AnyCable applications
Ruby
2
star
27

simple-cable-app

Minimal ActionCable/AnyCable application which could be deployed on Heroku
Ruby
1
star