Class: Rpush::Daemon::Dispatcher::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/rpush/daemon/dispatcher/http.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, delivery_class, _options = {}) ⇒ Http

Returns a new instance of Http.



5
6
7
8
9
# File 'lib/rpush/daemon/dispatcher/http.rb', line 5

def initialize(app, delivery_class, _options = {})
  @app = app
  @delivery_class = delivery_class
  @http = Net::HTTP::Persistent.new('rpush')
end

Instance Method Details

#cleanupObject



15
16
17
# File 'lib/rpush/daemon/dispatcher/http.rb', line 15

def cleanup
  @http.shutdown
end

#dispatch(payload) ⇒ Object



11
12
13
# File 'lib/rpush/daemon/dispatcher/http.rb', line 11

def dispatch(payload)
  @delivery_class.new(@app, @http, payload.notification, payload.batch).perform
end