./README.md in helios-0.2.1 vs ./README.md in helios-0.2.2

- old
+ new

@@ -74,11 +74,11 @@ require 'bundler' Bundler.require run Helios::Application.new do service :data, model: 'path/to/DataModel.xcdatamodel' - service :push_notification + service :push_notification, apn_certificate: 'path/to/apple_push_notification.pem', apn_environment: 'development' service :in_app_purchase service :passbook end ``` @@ -100,11 +100,11 @@ #### config/application.rb ```ruby config.middleware.use Helios::Application do service :data, model: 'path/to/DataModel.xcdatamodel' - service :push_notification + service :push_notification, apn_certificate: 'path/to/apple_push_notification.pem', apn_environment: 'development' service :in_app_purchase service :passbook end ``` @@ -162,10 +162,14 @@ </tr> <tr> <td><tt>DELETE /devices/:token</tt></td> <td>Unregister a device from receiving push notifications</td> </tr> + <tr> + <td><tt>POST /message</tt></td> + <td>Send out a push notification to some devices</td> + </tr> </table> --- `in_app_purchase`: Adds an endpoint for iOS in-app purchase receipt verification endpoints, as well one for returning product identifiers. @@ -264,10 +268,16 @@ To run Helios in development mode on `localhost`, run the `server` command: $ helios server +### Testing Push Notifications + +Once you have registered a device and set up your certificate, try this: + + $ curl -X POST -d 'payload={"aps": {"alert":"Blastoff!"}}' http://localhost:5000/message + ### Running the Helios Console You can start an IRB session with the runtime environment of the Helios application with the `console` command: $ helios console @@ -308,9 +318,24 @@ } failure:^(NSError *error) { NSLog(@"Registration Error: %@", error); }]; } ``` + +### Converting Your Push Notification Certificate + +> These instructions come from the [APN on Rails](https://github.com/PRX/apn_on_rails) project. + +Once you have the certificate from Apple for your application, export your key +and the apple certificate as p12 files. Here is a quick walkthrough on how to do this: + +1. Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key. +2. Right click and choose `Export 2 items…`. +3. Choose the p12 format from the drop down and name it `cert.p12`. + +Now covert the p12 file to a pem file: + + $ openssl pkcs12 -in cert.p12 -out apple_push_notification.pem -nodes -clcerts ## Coming Attractions There's still a lot to do to make Helios even better. Here are some ideas that are at the top of the list: