Action Cable is the WebSocket framework integrated into Ruby on Rails, providing real-time communication capabilities for Rails applications. The npm package 'actioncable' (current stable version 5.2.8-1, though the Rails ecosystem recommends using the latest 7.x or 8.x series) is the JavaScript client library that connects to an Action Cable server. It allows developers to subscribe to channels and receive broadcasts in the browser or any JavaScript runtime. Key differentiators: tight integration with Rails (session/cookie-based authentication, same MVC patterns), full-stack offering with both server- and client-side components, and pub-sub streaming model. Release cadence follows Rails releases, with frequent minor and patch updates. Alternatives include pure WebSocket libraries or Pusher, but Action Cable is the default for Rails real-time features.
npm install actioncableVerified import paths — ran on the pinned version, not inferred.
Shows how to create a consumer, subscribe to a channel, handle lifecycle events, send data, and clean up.
Pass a string URL or call without arguments to use the default from meta tags.
Use import from 'actioncable' instead of '@rails/actioncable'. Both publish the same code, but actioncable is the canonical name.
Install 'ws' package and set global.WebSocket = require('ws'); or use a bundler that polyfills WebSocket.Run 'npm install --save-dev @types/actioncable' to get type definitions.
Use the top-level API: ActionCable.createConsumer() and subscription methods.
Install the 'ws' package and add: global.WebSocket = require('ws'); before importing ActionCable.Change import to 'actioncable'.
Use import ActionCable from 'actioncable' for default import, and ensure the version is >=5.0.0.
Install @types/actioncable as a devDependency: npm install --save-dev @types/actioncable.
No dependency data recorded yet.