1 | # LoopBack Push Notification Component
|
2 |
|
3 | ![StrongLoop Labs](http://docs.strongloop.com/download/thumbnails/5310165/StrongLoop%20Labs%20Logo%20Cropped.png "StrongLoop Labs")
|
4 |
|
5 | > StrongLoop Labs projects provide early access to advanced or experimental functionality. In general, these projects may lack usability, completeness, documentation, and robustness, and may be outdated.
|
6 | However, StrongLoop supports these projects: Paying customers can open issues using the StrongLoop customer support system (Zendesk), and community users can report bugs on GitHub.
|
7 |
|
8 | This module provides a set of LoopBack models to enable mobile device push notifications.
|
9 |
|
10 | Please see the full documentation: [Push notifications](http://docs.strongloop.com/display/LB/Push+notifications).
|
11 |
|
12 | > The loopback-component-push module supersedes [loopback-push-notification](https://www.npmjs.org/package/loopback-push-notification). Please update your package.json accordingly.
|
13 |
|
14 | ## Architecture
|
15 |
|
16 | ![push-notification.png](push-notification.png)
|
17 |
|
18 | ## Key Components
|
19 |
|
20 | - Device model and APIs to manage devices with applications and users
|
21 | - Application model to provide push settings for device types such as ios and
|
22 | android
|
23 | - Notification model to capture notification messages and persist scheduled
|
24 | notifications
|
25 | - Optional Job to take scheduled notification requests
|
26 | - Push connector that interact with device registration records and push
|
27 | providers such as APNS, GCM, and MPNS
|
28 | - Push model to provide high level APIs for device-independent push notifications
|
29 |
|
30 | ## Samples
|
31 |
|
32 | ### Node.js server
|
33 |
|
34 | This module includes an [example LoopBack server application](https://github.com/strongloop/loopback-component-push/tree/master/example/server-2.0).
|
35 |
|
36 | To run it, use these commands:
|
37 |
|
38 | ```shell
|
39 | $ cd example/server
|
40 | $ npm install
|
41 | $ bower install
|
42 | $ node app
|
43 | ```
|
44 |
|
45 | Open your browser to [http://127.0.0.1:3010](http://127.0.0.1:3010).
|
46 |
|
47 | By default, the application uses an in-memory store for the application/installation data.
|
48 | To change to a MongoDB instance, set the MONGODB environment variable to the MongoDB URL. For example,
|
49 |
|
50 | ```shell
|
51 | MONGODB=mongodb://localhost/demo node app
|
52 | ```
|
53 |
|
54 | ### iOS client
|
55 |
|
56 | The [iOS example app](https://github.com/strongloop/loopback-component-push/tree/master/example/ios)
|
57 | uses the LoopBack iOS SDK to enable and handle push notifications.
|
58 |
|
59 | ### Android client
|
60 |
|
61 | The [Android example app](https://github.com/strongloop/loopback-component-push/tree/master/example/android)
|
62 | uses the LoopBack Android SDK to enable and handle push notifications.
|
63 |
|
64 | ## References
|
65 |
|
66 | - https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
|
67 | - http://developer.android.com/google/gcm/index.html
|
68 | - http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202945(v=vs.105).aspx
|
69 | - https://github.com/argon/node-apn
|
70 | - https://github.com/logicalparadox/apnagent-ios
|
71 | - https://blog.engineyard.com/2013/developing-ios-push-notifications-nodejs
|