Method: ActionCable::Channel::Streams#stream_from

Defined in:
lib/action_cable/channel/streams.rb

#stream_from(broadcasting, callback = nil) ⇒ Object

Start streaming from the named broadcasting pubsub queue. Optionally, you can pass a callback that'll be used instead of the default of just transmitting the updates straight to the subscriber.



71
72
73
74
75
76
77
78
# File 'lib/action_cable/channel/streams.rb', line 71

def stream_from(broadcasting, callback = nil)
  callback ||= default_stream_callback(broadcasting)

  streams << [ broadcasting, callback ]
  pubsub.subscribe broadcasting, &callback

  logger.info "#{self.class.name} is streaming from #{broadcasting}"
end