mirror of https://github.com/rails/rails
Add Channel#broadcast_to
This commit is contained in:
parent
dc80459a9e
commit
35bef64718
|
@ -7,7 +7,7 @@ module ActionCable
|
||||||
module Broadcasting
|
module Broadcasting
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
delegate :broadcasting_for, to: :class
|
delegate :broadcasting_for, :broadcast_to, to: :class
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
# Broadcast a hash to a unique broadcasting for this <tt>model</tt> in this channel.
|
# Broadcast a hash to a unique broadcasting for this <tt>model</tt> in this channel.
|
||||||
|
|
|
@ -180,7 +180,7 @@ class BroadcastsTestChannel < ActionCable::Channel::Base
|
||||||
def broadcast_to_user(data)
|
def broadcast_to_user(data)
|
||||||
user = User.new user_id
|
user = User.new user_id
|
||||||
|
|
||||||
self.class.broadcast_to user, text: data["message"]
|
broadcast_to user, text: data["message"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue