Class: Citrus::PushSchedulers::Direct

Inherits:
Object
  • Object
show all
Defined in:
lib/citrus/push_schedulers/direct.rb

Overview

Direct

Instance Method Summary collapse

Constructor Details

#initialize(app, args) ⇒ Direct

Initialize the component

Parameters:

  • app (Object)
  • args (Hash)


18
19
20
# File 'lib/citrus/push_schedulers/direct.rb', line 18

def initialize app, args
  @app = app
end

Instance Method Details

#schedule(req_id, route, msg, recvs, args, &block) ⇒ Object

Schedule

Parameters:

  • req_id (Integer)
  • route (String)
  • msg (Hash)
  • recvs (Array)
  • args (Hash)


29
30
31
32
33
34
35
36
37
# File 'lib/citrus/push_schedulers/direct.rb', line 29

def schedule req_id, route, msg, recvs, args, &block
  if args[:type] == 'broadcast'
    do_broadcast msg, args[:user_args]
  else
    do_batch_push msg, recvs
  end

  EM.next_tick { block.call } if block_given?
end