| 1 |
Let's describe the push system by way of an example. |
| 2 |
|
| 3 |
Alice has written a chat application called Chatter. Using it, Bob can send messages to Carol and viceversa. Alice has a |
| 4 |
web application for it, so the way it works now is that Bob connects to the service, posts a message, and when Carol |
| 5 |
connects, she gets it. If Carol leaves the browser window open, it beeps when messages arrive. |
| 6 |
|
| 7 |
Now Alice wants to create an app for Chatter, so she implements the same architecture using a client that |
| 8 |
does the same thing as the web browser. Sadly, since applications under Lomiri don't run continuously, messages are |
| 9 |
only delivered when Carol opens the app, and the user experience suffers. |
| 10 |
|
| 11 |
Using the Lomiri Push Server, this problem is alleviated: the Chatter server will deliver the messages to the Lomiri |
| 12 |
Push Server, which in turn will send it in an efficient manner to the Lomiri Push Service running in Bob and Carol's |
| 13 |
devices. The user sees a notification (all without starting the app) and then can launch it if he's interested in |
| 14 |
reading messages at that point. |
| 15 |
|
| 16 |
Since the app is not started and messages are delivered oportunistically, this is both battery and bandwidth-efficient. |
| 17 |
|
| 18 |
.. figure:: push.svg |
| 19 |
|
| 20 |
The Lomiri Push system provides: |
| 21 |
|
| 22 |
* A push server which receives **push messages** from the app servers, queues them and delivers them efficiently |
| 23 |
to the devices. |
| 24 |
* A push client which receives those messages, queues messages to the app and displays notifications to the user |
| 25 |
|
| 26 |
The full lifecycle of a push message is: |
| 27 |
|
| 28 |
* Created in a application-specific server |
| 29 |
* Sent to the Lomiri Push server, targeted at a user or user+device pair |
| 30 |
* Delivered to one or more Lomiri devices |
| 31 |
* Passed through the application helper for processing |
| 32 |
* Notification displayed to the user (via different mechanisms) |
| 33 |
* Application Message queued for the app's use |
| 34 |
|
| 35 |
If the user interacts with the notification, the application is launched and should check its queue for messages |
| 36 |
it has to process. |
| 37 |
|
| 38 |
For the app developer, there are several components needed: |
| 39 |
|
| 40 |
* A server that sends the **push messages** to the Lomiri Push server |
| 41 |
* Support in the client app for registering with the Lomiri Push service client |
| 42 |
* Support in the client app to react to **notifications** displayed to the user and process **application messages** |
| 43 |
* A helper program with application-specific knowledge that transforms **push messages** as needed. |
| 44 |
|
| 45 |
In the following sections, we'll see how to implement all the client side parts. For the application server, see the |
| 46 |
`Lomiri Push Server API section <#lomiri-push-server-api>`__ |