pushmq
transparently handle push notifications across multiple services (apns,gcm), backed by a queue (rabbitmq, more to come).
Usage
Install via NPM
$ npm install pushmq
Example- Publisher
var pushmq = ;var config = ;var rabbit = configrabbitmq ;var apns = configapns ;var publisher = 'apple_notifications'rabbit; publisher
Example- Worker (simple)
var pushmq = ;var config = ;var rabbit = configrabbitmq ;var apns = configapns ;var worker = 'apple_notifications'rabbitapns; // start the worker and transparently process APNS messages over the rabbitmq transportworker;
Example- Worker (advanced)
var pushmq = ;var config = ;var rabbit = configrabbitmq ;var apns = configapns ;var worker = 'apple_notifications'rabbitapns; // start the worker and pass in a function to handle notifications. // Function receives 3 args (data,next,acknowledge). This allows you to// 1) modify the data being pushed, or 2) short-circuit the notification.// The 'next' function actually sends the push notification and takes// two arguments ( data, acknowledge ). Messages must be acknowledged in// order for the queue to be processed, so acknowledge must be passed as a// callback to 'next'. worker; // An additional queue will be created that contains tokens that // have been rejected by the service provider. You can subscribe// to this queue as well. Again, these messages must be acknowledged// in order to run continuously. worker