Joseph Clarke

Joined

320 Experience
3 Lessons Completed
0 Questions Solved

Activity

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_#{current_user.id}"
end
end

cable_ready["user:user_channel_#{user_id}"].inner_html(
selector: "#update_div",
html: html
)
cable_ready.broadcast

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?