However, in some points, it’s getting outdated and needs refresh.
It uses CoffeeScript, which is not a default language anymore for Rails 6.
It uses cable.js file, which is not generated with Channel generator by Rails 6 any more.
It uses jquery-rails, which is also not included by default in Rails 6.
And most importantly, Rails version is 5,1.
Also I found the problem that although it’s mentioned as “complete” example, it doesn’t cover the whole usage the guide mentions.
I’d suggest adding new demo application for Rails 6 alongside the existing one. That’s mainly because things generated by a channel generator are quite different from older versions.
I am on Rails 6, and found myself mentally translating CoffeeScript to JavaScript. Does it need to be seperate, or can it live on a branch for Rails 5, 6, and 7? Same app, just three versions? Nice to help you compare versions to figure out your own upgrade path.
Now I don’t think this example repository should exist in purpose of documentation. It’s hard to maintain it, and there are so many others ways to use ActionCable (e.g. my team uses it with React Hooks).
If we have OSS Rails applications that use ActionCable, we can just point them as references. I looked at Discourse, Mastodon and Forem but none of them use it, so maybe no luck?
Basically I need to change all the things including the language (from CoffeeScript to the latest ES or TypeScript) and yet it’s not comprehensive enough. That’s why I don’t find it valuable.
Funny you should mention it, I’m trying to figure out why broadcasts work from the controller but don’t get appended to the relevant dom element and I don’t get any console logs from onConnect() and so I thought maybe the problem was there’s no cable.js file