Module: APN

Defined in:
lib/apn/queue_manager.rb,
lib/apn/sender.rb,
lib/apn/feedback.rb,
lib/apn/queue_name.rb,
lib/apn/notification.rb,
lib/apn/sender_daemon.rb,
lib/apn/connection/base.rb,
lib/apn/notification_job.rb

Overview

Extending Resque to respond to the before_unregister_worker hook. Note this requires a matching monkeypatch in the Resque::Worker class. See resque/hooks/before_unregister_worker.rb for an example implementation

Defined Under Namespace

Modules: Connection Classes: Feedback, FeedbackItem, Notification, NotificationJob, QueueManager, Sender, SenderDaemon

Constant Summary collapse

QUEUE_NAME =

Change this to modify the queue from which notification jobs are pushed and pulled

:apple_push_notifications

Class Method Summary collapse

Class Method Details

.notify(token, opts = {}) ⇒ Object

Enqueues a notification to be sent in the background via the persistent TCP socket, assuming apn_sender is running (or will be soon)



7
8
9
10
# File 'lib/apn/queue_manager.rb', line 7

def self.notify(token, opts = {})
  token = token.to_s.gsub(/\W/, '')
  APN::QueueManager.enqueue(APN::NotificationJob, token, opts)
end