Class: Rpush::Daemon::Dispatcher::Tcp
- Inherits:
-
Object
- Object
- Rpush::Daemon::Dispatcher::Tcp
- Defined in:
- lib/rpush/daemon/dispatcher/tcp.rb
Direct Known Subclasses
Instance Method Summary collapse
- #cleanup ⇒ Object
- #dispatch(payload) ⇒ Object
-
#initialize(app, delivery_class, options = {}) ⇒ Tcp
constructor
A new instance of Tcp.
Constructor Details
#initialize(app, delivery_class, options = {}) ⇒ Tcp
Returns a new instance of Tcp.
5 6 7 8 9 |
# File 'lib/rpush/daemon/dispatcher/tcp.rb', line 5 def initialize(app, delivery_class, = {}) @app = app @delivery_class = delivery_class @host, @port = [:host].call(@app) end |
Instance Method Details
#cleanup ⇒ Object
15 16 17 |
# File 'lib/rpush/daemon/dispatcher/tcp.rb', line 15 def cleanup @connection.close if @connection end |
#dispatch(payload) ⇒ Object
11 12 13 |
# File 'lib/rpush/daemon/dispatcher/tcp.rb', line 11 def dispatch(payload) @delivery_class.new(@app, connection, payload.notification, payload.batch).perform end |