rails-action-cable
Installation
SKILL.md
Rails Action Cable
Architecture
- Use one channel per resource domain (e.g.,
ChatChannel,RoomChannel) - Channels manage WebSocket subscriptions; streams represent broadcast sources
- Use multiple
stream_fororstream_fromcalls within one channel when needed - Use Solid Cable in production — the Rails 8 default DB-backed pub/sub adapter (no Redis required; ~1 day message retention)
- Never use dynamic string interpolation in stream names without explicit authorization
Subscription Lifecycle
- Always define both
subscribedandunsubscribedmethods - Call
stream_for resourceorstream_from "stream_name"insidesubscribed - Call
stop_all_streamsinunsubscribedto clean up - Set
current_useronly inApplicationCable::Connection#connect, not in channels