Ruby on Rails
Friday, April 1, 2016
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
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8a277357-ea8e-4a81-8c63-4db03557328a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment