Git Product home page Git Product logo

anycable-rails's Introduction

GitPitch Gem Version Build Status Gitter 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.

Sponsored by Evil Martians

Requirements

  • Ruby ~> 2.4; NOTE: for Ruby 2.6 use RC version of google-protobuf gem. In your Gemfile: gem "google-protobuf", '>=3.7.0.rc.2'
  • Rails ~> 5.0;
  • Redis (see other options for broadcasting)

How It Works?

Usage

Add anycable-rails gem to your Gemfile:

gem "anycable-rails"

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

(and don't forget to run bundle install).

Next, specify AnyCable subscription adapter for Action Cable:

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

and specify AnyCable WebSocket server URL:

# For development it's likely the localhost

# config/environments/development.rb
config.action_cable.url = "ws://localhost:3334/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"

hen, 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=3334

See documentation for more information on AnyCable + Rails usage.

Action Cable Compatibility

See documentation.

Links

Talks

Compatible WebSocket servers

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.

anycable-rails's People

Contributors

palkan avatar sponomarev avatar dmitrytsepelev avatar depfu[bot] avatar envek avatar nerzh avatar sespindola avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.