Gem Version Join the chat at

Rpush. The push notification service for Ruby.

Rpush aims to be the de facto gem for sending push notifications in Ruby. Its core goals are ease of use, reliability and a rich feature set. Rpush provides numerous advanced features not found in others gems, giving you greater control & insight as your project grows. These are a few of the reasons why companies worldwide rely on Rpush to deliver their notifications.

Supported Services

Feature Highlights

Getting Started

Add it to your Gemfile:

gem 'rpush'

Initialize Rpush into your project. Rails will be detected automatically.

$ cd /path/to/project
$ rpush init

Create an App & Notification

Apple Push Notification Service

If this is your first time using the APNs, you will need to generate SSL certificates. See Generating Certificates for instructions.

app = = "ios_app"
app.certificate ="/path/to/sandbox.pem")
app.environment = "sandbox" # APNs environment.
app.password = "certificate password"
app.connections = 1!
n = = Rpush::Apns::App.find_by_name("ios_app")
n.device_token = "..." # 64-character hex string
n.alert = "hi mom!" = { foo: :bar }!

The url_args attribute is available for Safari Push Notifications.

You should also implement the ssl_certificate_will_expire reflection to monitor when your certificate is due to expire.

Google Cloud Messaging

app = = "android_app"
app.auth_key = "..."
app.connections = 1!
n = = Rpush::Gcm::App.find_by_name("android_app")
n.registration_ids = ["..."] = { message: "hi mom!" }!

GCM also requires you to respond to Canonical IDs.

Amazon Device Messaging

app = = "kindle_app"
app.client_id = "..."
app.client_secret = "..."
app.connections = 1!
n = = Rpush::Adm::App.find_by_name("kindle_app")
n.registration_ids = ["..."] = { message: "hi mom!"}
n.collapse_key = "Optional consolidationKey"!

For more documentation on ADM.

Windows Phone Notification Service

app = = "windows_phone_app"
app.client_id = # Get this from your apps dashboard
app.client_secret = # Get this from your apps dashboard
app.connections = 1!
n = = Rpush::Wpns::App.find_by_name("windows_phone_app")
n.uri = "http://..." = {title:"MyApp", body:"Hello world", param:"user_param1"}!

Running Rpush

It is recommended to run Rpush as a separate process in most cases, though embedding and manual modes are provided for low-workload environments.

See rpush help for all available commands and options.

As a daemon

$ cd /path/to/project
$ rpush start

On the command-line

$ rpush push

Rpush will deliver all pending notifications and then exit.

In a scheduled job


See Push API for more details.

Embedded inside an existing process

if defined?(Rails)
  ActiveSupport.on_load(:after_initialize) do

Call this during startup of your application, for example, by adding it to the end of config/rpush.rb. See Embedding API for more details.


See Configuration for a list of options.

Updating Rpush

You should run rpush init after upgrading Rpush to check for configuration and migration changes.

From The Wiki


Apple Push Notification Service

Google Cloud Messaging


When running specs, please note that the ActiveRecord adapter can be changed by setting the ADAPTER environment variable. For example: ADAPTER=postgresql rake.

Available adapters for testing are mysql, mysql2 and postgresql.

Note that the database username is changed at runtime to be the currently logged in user's name. So if you're testing with mysql and you're using a user named 'bob', you will need to grant a mysql user 'bob' access to the 'rpush_test' mysql database.

To switch between ActiveRecord and Redis, set the CLIENT environment variable to either active_record, redis or mongoid.

Build Status Test Coverage Code Climate