Is this thing still on?
Over the past 24 hours I’ve finally come to understand that all ActionCable channels which import
consumer.js share the same connection to the server. This is a critical first step towards building a scalable AC-powered solution. The alternative is to call createConsumer directly and increase connection overhead linearly. I urge you to directly call out this insight in the Guide; it’s non-obvious that consumer is a memoized instance of a consumer until you’re forced to become an expert.
With apologies for burying the lede, I believe that if the ActionCable framework is present (not-skipped) during
rails new, the
import 'channels' should be added to the
These files don’t exist until someone runs
rails generate channel test for the first time, and since it’s easily possible to productively import and use
createConsumer() in a Stimulus controller without ever running a generator, that means that there’s no
consumer.js floating around for all of these consumers to import.
I propose that running a channel generator should only generate the test_channel.rb and test_channel.js, not the infrastructure for using ActionCable in a resource-effective way.