Joseph Clarke


320 Experience
3 Lessons Completed
0 Questions Solved


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

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?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.