GithubHelp home page GithubHelp logo

joefiorini / rack-push-notification Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mattt/rack-push-notification

0.0 2.0 0.0 481 KB

A Rack-mountable webservice for managing push notifications

License: MIT License

rack-push-notification's Introduction

Rack::PushNotification

A Rack-mountable webservice for managing push notifications

Rack::PushNotification generates API endpoints that can be consumed by iOS apps to register and unregister for push notifications.

Example Record

token"ce8be627 2e43e855 16033e24 b4c28922 0eeda487 9c477160 b2545e95 b68b5969"
alias[email protected]
badge0
localeen_US
languageen
timezoneAmerica/Los_Angeles
ip_address0.0.0.0
lat37.7716
lng-122.4137
tags["iPhone OS 6.0", "v1.0", "iPhone"]

Each device has a token, which uniquely identifies the app installation on a particular device. This token can be associated with an alias, which can be a domain-specific piece of identifying information, such as a username or e-mail address. A running badge count is used to keep track of the badge count to show on the app icon.

A device's locale & language can be used to localize outgoing communications to that particular user. Having timezone information gives you the ability to schedule messages for an exact time of day, to ensure maximum impact (and minimum annoyance). ip_address as well as lat and lng allows you to specifically target users according to their geographic location.

It is strongly recommended that you use Rack::PushNotification in conjunction with some sort of Rack authentication middleware, so that the administration endpoints are not accessible without some form of credentials.

Example Usage

Rack::PushNotification can be run as Rack middleware or as a single web application. All that is required is a connection to a Postgres database. You must define this with the environment variable DATABASE_URL. For rails, use the rails-database-url to define this from the database.yml.

config.ru

require 'bundler'
Bundler.require

run Rack::PushNotification

An example application can be found in the /example directory of this repository.

iOS Client Library

To get the full benefit of Rack::PushNotification, use the Orbiter library to register for Push Notifications on iOS.

#import "Orbiter.h"

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSURL *serverURL = [NSURL URLWithString:@"http://raging-notification-3556.herokuapp.com/"]
    Orbiter *orbiter = [[Orbiter alloc] initWithBaseURL:serverURL credential:nil];
    [orbiter registerDeviceToken:deviceToken withAlias:nil success:^(id responseObject) {
        NSLog(@"Registration Success: %@", responseObject);
    } failure:^(NSError *error) {
        NSLog(@"Registration Error: %@", error);
    }];
}

Deployment

Rack::PushNotification can be deployed to Heroku with the following commands:

$ heroku create
$ git push heroku master

Contact

Mattt Thompson

License

Rack::PushNotification is available under the MIT license. See the LICENSE file for more info.

rack-push-notification's People

Contributors

mattt avatar dennisreimann avatar mxswd avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.