APNS(iOS), C2DN (Android), etc. notification systems are in use.

deviceid – device token (APNs), registration id (C2DN), etc.;

username – login. The field can be blank.

Subscribing

When the app connects to service, the subscription is performed. When the app is closed, the notifications are still received.

POST 

http://example.com:[port][/somecontext]/secure/subscription/

Sample of response:

XML

Content-Type  :  application/xml

<subscription>
    <username>johndoe<username>
    <deviceid>somedeviceid</deviceid>
</subscription>

JSON

Content-Type :  application/json

{
    "username" : "johndoe",
    "deviceid" : "somedeviceid"
}

Subscription cancellation

Subscription is cancelled in the following cases:

APN message format

{

"aps" : {

                     "alert" : "Motion Detected",

                     "badge" : 2 //ordinal number of the message. Numbers are given one after another after the latest subscribing.

             },

     "e" : {

                "srv" : "XXX",  //server id. Unique in one iOS device

                "stt" : 88,   //state id(see The list of states for a specific object class)

                "obj" : "6", //object id

                "ts" : "2010-08-02T23:30:00Z" //time of sending the event

            }

}