• Stars
    star
    495
  • Rank 88,952 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 3 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,922
star
2

anycable-go

AnyCable real-time server
Go
366
star
3

anycable_rails_demo

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

graphql-anycable

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

anycable-client

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

anycable_demo

Anycable demo application
Ruby
53
star
7

erlycable

Anycable Erlang WebSocket server
Erlang
45
star
8

xk6-cable

A k6 extension for testing Action Cable and AnyCable functionality
Go
26
star
9

anycable-rack-server

AnyCable-compatible Ruby Rack middleware
Ruby
25
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
18
star
12

anyt

AnyCable conformance testing tool
Ruby
13
star
13

anycable-twilio-hanami-demo

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

vercel-anycable-demo

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

websocket-bench

CLI interface for benchmark AnyCable
Go
10
star
16

anycable-serverless-js

AnyCable channels API for serverless
TypeScript
9
star
17

docs.anycable.io

AnyCable documentation
Ruby
9
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

caddy-anycable

AnyCable module for Caddy
Go
3
star
25

uptriever

A CLI to upload documentation chunks to Trieve
Ruby
3
star
26

github-actions

Reusable Github Actions for AnyCable projects
2
star
27

homebrew-anycable

Anycable homebrew formulae
2
star
28

kuby-anycable

Kuby plugin to deploy AnyCable applications
Ruby
2
star
29

anycable-pubsub-nextjs

AnyCable / Next.js minimal example
TypeScript
1
star
30

simple-cable-app

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