September 2022
Intermediate to advanced
410 pages
10h 7m
English
The Turbo ActionCable helpers are great, but they don’t cover every use case for ActionCable we might have. You may need to use ActionCable by using custom JavaScript on the client, either because there is an already existing endpoint or because your task doesn’t quite fit with the Turbo patterns. In this section, we’re going to use ActionCable to rebuild the “sold out” feature we previously built using polling in Chapter 8, Talking to the Server.
To use ActionCable directly, we need to create objects on the client and on the server. On the server, we have channels and connections. An ActionCable channel is roughly analogous to a Rails controller. The channel is where you put the code that responds to data the server ...