Method: ActionCable::Channel::Streams#stream_for
- Defined in:
- lib/action_cable/channel/streams.rb
#stream_for(broadcastables, callback = nil, coder: nil, &block) ⇒ Object
Start streaming the pubsub queue for the broadcastables in this channel. Optionally, you can pass a callback that’ll be used instead of the default of just transmitting the updates straight to the subscriber.
Pass ‘coder: ActiveSupport::JSON` to decode messages as JSON before passing to the callback. Defaults to `coder: nil` which does no decoding, passes raw messages.
118 119 120 |
# File 'lib/action_cable/channel/streams.rb', line 118 def stream_for(broadcastables, callback = nil, coder: nil, &block) stream_from(broadcasting_for(broadcastables), callback || block, coder: coder) end |