Module: Alondra::Pushing

Included in:
EventListener
Defined in:
lib/alondra/pushing.rb

Instance Method Summary collapse

Instance Method Details

#push(*args) ⇒ Object

Raises:



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/alondra/pushing.rb', line 6

def push(*args)
  raise PushingException.new('You need to specify the channel to push') unless args.last[:to].present?

  to = args.last.delete(:to)
  
  # If we are called in the context of a request we save this information
  # so we can create proper routes
  caller_request = self.respond_to?(:request) ? request : nil
  
  controller = PushController.new(self, to, caller_request)
  controller.render_push(args)
end