instance method broadcasting_for

Ruby on Rails 8.0.4

Since v6.0.6

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

Signature

broadcasting_for(model)

Returns a unique broadcasting identifier for this model in this channel:

CommentsChannel.broadcasting_for("all") # => "comments:all"

You can pass any object as a target (e.g. Active Record model), and it would be serialized into a string under the hood.

Parameters

model req
Source
# File actioncable/lib/action_cable/channel/broadcasting.rb, line 24
        def broadcasting_for(model)
          serialize_broadcasting([ channel_name, model ])
        end

Defined in actioncable/lib/action_cable/channel/broadcasting.rb line 24 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionCable::Channel::Broadcasting::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close