Class: ActionCable::Server::Broadcasting::Broadcaster
Relationships & Source Files | |
Inherits: | Object |
Defined in: | actioncable/lib/action_cable/server/broadcasting.rb |
Class Method Summary
- .new(server, broadcasting, coder:) ⇒ Broadcaster constructor
Instance Attribute Summary
- #broadcasting readonly
- #coder readonly
- #server readonly
Instance Method Summary
Constructor Details
.new(server, broadcasting, coder:) ⇒ Broadcaster
# File 'actioncable/lib/action_cable/server/broadcasting.rb', line 46
def initialize(server, broadcasting, coder:) @server, @broadcasting, @coder = server, broadcasting, coder end
Instance Attribute Details
#broadcasting (readonly)
[ GitHub ]#coder (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/server/broadcasting.rb', line 44
attr_reader :server, :broadcasting, :coder
#server (readonly)
[ GitHub ]# File 'actioncable/lib/action_cable/server/broadcasting.rb', line 44
attr_reader :server, :broadcasting, :coder
Instance Method Details
#broadcast(message)
[ GitHub ]# File 'actioncable/lib/action_cable/server/broadcasting.rb', line 50
def broadcast( ) server.logger.debug { "[ActionCable] Broadcasting to #{broadcasting}: #{ .inspect.truncate(300)}" } payload = { broadcasting: broadcasting, message: , coder: coder } ActiveSupport::Notifications.instrument("broadcast.action_cable", payload) do encoded = coder ? coder.encode( ) : server.pubsub.broadcast broadcasting, encoded end end