0.0
No commit activity in last 3 years
No release in over 3 years
EventMachine multiple APNs connections Management Solution. You can use multiple cert and connection to apple's APNs server.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8.4
>= 0

Runtime

 Project Readme

EventMachine APN Manager

EventMachine APN Connection Manager, The purpose is to support multiple cert and multiple application with one process. It use redis pubsub to get message from application, then send message to apple, also kept the connection to APNS server, so it won't be blocked by apple.

Steps for running with Rails:

  1. Add below line to Gemfile:
gem 'em_apn_manager', git: 'git@github.com:hlxwell/em_apn_manager.git'
  1. Generate config/em_apn_manager.yml file:
bundle exec rails g event_machine:apn_manager:install
  1. Run the server
bundle exec em_apn_manager server -e development

Steps for running Standalone:

  1. Install em_apn_manager gem
gem install em_apn_manager
  1. Run
// read redis from url
em_apn_manager server -r redis://localhost:6379/em_apn_manager

or

// read redis config from config
em_apn_manager server -c CONFIG_FILE_PATH -e development

Put below line to your code for sending push notification:

EM::ApnManager.push_notification({
  env: CERT_ENVIRONMENT,
  cert: PEM_CERT_TEXT_CONTENT,
  token: DEVICE_TOKEN,
  message: YOUR_MESSAGE
})

or if you don't need to install em_apn_manager in your project, you can do this:

your_redis_instance.publish "push-notification", {
  env: "development",
  cert: cert,
  token: options[:token],
  message: options[:message]
}.to_json

If you want to run server in background:

em_apn_manager server --daemon --pid_file /PATH/TO/PID

or

em_apn_manager server -d -p /PATH/TO/PID

Generate pem from p12

This is the Tutorial for how to get p12 file.

You have to convert p12 format to pem format by below command line.

openssl pkcs12 -in cert.p12 -out cert.pem -nodes -clcerts