Class: Rpush::Daemon::Dispatcher::Http
- Inherits:
-
Object
- Object
- Rpush::Daemon::Dispatcher::Http
- Defined in:
- lib/rpush/daemon/dispatcher/http.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
- #dispatch(payload) ⇒ Object
-
#initialize(app, delivery_class, _options = {}) ⇒ Http
constructor
A new instance of Http.
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, = {}) @app = app @delivery_class = delivery_class @http = Net::HTTP::Persistent.new(name: 'rpush') end |
Instance Method Details
#cleanup ⇒ Object
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 |