class Rpush::Daemon::Dispatcher::Tcp

Public Class Methods

new(app, delivery_class, options = {}) click to toggle source
# 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)
  @connection = Rpush::Daemon::TcpConnection.new(@app, @host, @port)
end

Public Instance Methods

cleanup() click to toggle source
# File lib/rpush/daemon/dispatcher/tcp.rb, line 16
def cleanup
  @connection.close if @connection
end
dispatch(payload) click to toggle source
# File lib/rpush/daemon/dispatcher/tcp.rb, line 12
def dispatch(payload)
  @delivery_class.new(@app, @connection, payload.notification, payload.batch).perform
end