instance method
transmit
Ruby on Rails 7.0.10
Since v5.2.8.1 PrivateSignature
transmit(data, via: nil)
Transmit a hash of data to the subscriber. The hash will automatically be wrapped in a JSON envelope with the proper channel identifier marked as the recipient.
Parameters
-
datareq -
viakey = nil
Source
# File actioncable/lib/action_cable/channel/base.rb, line 211
def transmit(data, via: nil) # :doc:
status = "#{self.class.name} transmitting #{data.inspect.truncate(300)}"
status += " (via #{via})" if via
logger.debug(status)
payload = { channel_class: self.class.name, data: data, via: via }
ActiveSupport::Notifications.instrument("transmit.action_cable", payload) do
connection.transmit identifier: @identifier, message: data
end
end
Defined in actioncable/lib/action_cable/channel/base.rb line 211
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionCable::Channel::Base