Class: Rpush::Daemon::Dispatcher::Tcp

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

Instance Method Summary collapse

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, options = {})
  @app = app
  @delivery_class = delivery_class
  @host, @port = options[:host].call(@app)
end

Instance Method Details

#cleanupObject



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

def cleanup
  @connection.close if @connection
end

#dispatch(notification, batch) ⇒ Object



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

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