Methods
Attributes
[R] | broadcasting | |
[R] | coder | |
[R] | server |
Class Public methods
new(server, broadcasting, coder:)
📝 Source code
# File actioncable/lib/action_cable/server/broadcasting.rb, line 38
def initialize(server, broadcasting, coder:)
@server, @broadcasting, @coder = server, broadcasting, coder
end
🔎 See on GitHub
Instance Public methods
broadcast(message)
📝 Source code
# File actioncable/lib/action_cable/server/broadcasting.rb, line 42
def broadcast(message)
server.logger.debug { "[ActionCable] Broadcasting to #{broadcasting}: #{message.inspect.truncate(300)}" }
payload = { broadcasting: broadcasting, message: message, coder: coder }
ActiveSupport::Notifications.instrument("broadcast.action_cable", payload) do
encoded = coder ? coder.encode(message) : message
server.pubsub.broadcast broadcasting, encoded
end
end
🔎 See on GitHub