What is correct way to filter broadcasted messages [ActionCable]

14 views
Skip to first unread message

nate.t...@gmail.com

unread,
Apr 1, 2016, 10:09:33 AM4/1/16
to Ruby on Rails: Talk
Hey guys,

Let's assume we have mute command in chat application, users are subscribed to all messages. But some users mutes other users, is there any way to not deliver messages from muted user to those who muted him? If we simply do rebroadcast in our ChatChannel?

# app/channels/chat_channel.rb
class ChatChannel < ApplicationCable::Channel
 
def subscribed
    stream_from
"chat"
 
end

 
def receive(data)
   
ChatChannel.broadcast_to "chat", data
 
end
end


Reply all
Reply to author
Forward
0 new messages