Class: Rapns::Daemon::Apns::DeliveryHandler

Inherits:
DeliveryHandler show all
Defined in:
lib/rapns/daemon/apns/delivery_handler.rb

Constant Summary collapse

HOSTS =
{
  :production  => ['gateway.push.apple.com', 2195],
  :development => ['gateway.sandbox.push.apple.com', 2195], # deprecated
  :sandbox     => ['gateway.sandbox.push.apple.com', 2195]
}

Constants inherited from DeliveryHandler

DeliveryHandler::WAKEUP

Instance Attribute Summary

Attributes inherited from DeliveryHandler

#queue

Instance Method Summary collapse

Methods inherited from DeliveryHandler

#start, #stop, #wait, #wakeup

Methods included from Reflectable

#reflect

Constructor Details

#initialize(app) ⇒ DeliveryHandler

Returns a new instance of DeliveryHandler.



11
12
13
14
# File 'lib/rapns/daemon/apns/delivery_handler.rb', line 11

def initialize(app)
  @app = app
  @host, @port = HOSTS[@app.environment.to_sym]
end

Instance Method Details

#deliver(notification, batch) ⇒ Object



16
17
18
# File 'lib/rapns/daemon/apns/delivery_handler.rb', line 16

def deliver(notification, batch)
  Rapns::Daemon::Apns::Delivery.new(@app, connection, notification, batch).perform
end

#stoppedObject



20
21
22
# File 'lib/rapns/daemon/apns/delivery_handler.rb', line 20

def stopped
  @connection.close if @connection
end