instance method transmit

Ruby on Rails 7.1.6

Since v5.2.8.1 Private

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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

data req
via key = nil
Source
# File actioncable/lib/action_cable/channel/base.rb, line 214
        def transmit(data, via: nil) # :doc:
          logger.debug do
            status = "#{self.class.name} transmitting #{data.inspect.truncate(300)}"
            status += " (via #{via})" if via
            status
          end

          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 214 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionCable::Channel::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close