Ask A Question


You’re not receiving notifications from this thread.

Realtime browser updates with Cable Ready Discussion

Great episode.

Just as a note to anybody watching this who might be wondering, cable_ready pairs perfectly well with Stimulus Reflex as well. You can simply include the cable_ready call in your *_reflex.rb file and it will cause the reflex change to be broadcast out to every connected client at the same time as the reflex (technically right before, but close enough).


This is so much easier to implement compared to using a front end framework like React. I wish I knew about these concepts earlier!


Is there a way to create a channel that only broadcasts to a specific signed in user? For example just send the broadcast to the user who created the card instead of everyone currently connected to the application?


Sure, this can be done in my different ways. You could include a "data-user-id='#{}'" in your template and set the selector option in your cable_ready call to be "[data-user-id='#{}']".

This would work, but if your use case is to only update to the current user, Stimulus Reflex does that out of the box.


Thanks Michael.

It also looks like I can do this by including the user id in the stream name as well and it will only send the update to any connections that user has.

class UserChannel < ApplicationCable::Channel
def subscribed
stream_for "user_channel_#{}"

selector: "#update_div",
html: html


Hi! Is there anyone can help me?
I was trying implement the cable_ready by following this tutorial. But unfortunately, the cable_ready didn't work well. It just broadcast the data, but the client didn't receive that data. I also tried cloning the repo from this tutorial to my local machine, it also didn't work. Idk why, I'm still figuring it out.


facing a similar issue.. its broadcasting the data, but not updating the views. wondering if I'm doing something wrong related to action cable. were you able to fix yours?


had to change my cable.yml file to the below and its working fine.

  adapter: redis
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>

  adapter: async

  adapter: redis
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>

I have an application using ActionCable broadcasting to about 100 TV screens when a new event happens.
This works great on local machine but on server (centOS, NGINX) I see a lot of Broken Pipe messages and many screens don't receive the updates.
Would this be a better solution or have the same problem since it's using the same technology under the hood? Please advice


Hi Peter, I'd be happy to discuss the probems that you're seeing and make some suggestions about how best to proceed.

CableReady is based ActionCable, which should be able to scale to ~4000 concurrent connections. There are other solutions beyond that stage.

Just jump on the #cableready channel on the StimulusReflex Discord:

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,453+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.