This project is no longer being maintained, as the Rails team has published an official npm package.
Standalone ActionCable Javascript from Rails 5 for usage outside of Ruby on Rails (e.g. with ES6/ES7 apps, React/Angular JS, etc.)
actioncable-js can be installed using npm:
npm install actioncable-js
And included in your ES6+ project with:
import { ActionCable } from 'actioncable-js';
Alternatively, simply include dist/action_cable.js
in your project.
ActionCable documentation is available here.
A simple HTML/JS example app is provided in examples/
. Simply put examples/clock_channel.rb
in your Rails 5 app, launch the Rails server, and open examples/clock_channel.html
in your web browser. This app assumes that ActionCable is mounted at http://localhost:3000
.
You can update and recompile action_cable.js by running ./update.sh
.
actioncable-js is released under the MIT license: