方法
属性
[R] | broadcasting | |
[R] | coder | |
[R] | server |
类公共方法
new(server, broadcasting, coder:) 链接
源代码: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/server/broadcasting.rb, line 46 def initialize(server, broadcasting, coder:) @server, @broadcasting, @coder = server, broadcasting, coder end
实例公共方法
broadcast(message) 链接
源代码: 显示 | 在 GitHub 上
# File actioncable/lib/action_cable/server/broadcasting.rb, line 50 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