From: Younho Park Date: Wed, 23 Dec 2015 07:25:43 +0000 (+0900) Subject: [Tutorial][Messaging][Push] Added Multiple Request & Multicast X-Git-Tag: tizen_3.0/TD_SYNC/20161201~256^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=406ae1fffe2c6948ebcccd6afda928366095a777;p=sdk%2Fonline-doc.git [Tutorial][Messaging][Push] Added Multiple Request & Multicast Change-Id: I1c464a228029a130edda2fba77e2094dc26d8103 Signed-off-by: Younho Park --- diff --git a/org.tizen.tutorials/html/native/messaging/push_tutorial_n.htm b/org.tizen.tutorials/html/native/messaging/push_tutorial_n.htm index d9ce771..68d9a7a 100644 --- a/org.tizen.tutorials/html/native/messaging/push_tutorial_n.htm +++ b/org.tizen.tutorials/html/native/messaging/push_tutorial_n.htm @@ -552,7 +552,16 @@ push_service_deregister(push_conn, _dereg_result_cb, NULL);

The message field takes effect only when the application is not running (more precisely, when the application is not connected to the push service.) If a notification with the above message field arrives at the device where the application is running, the push service delivers the notification directly to the application, neither showing the "Hi" message in the quick panel nor increasing the badge count.

-
  • Send notifications. + + + + + + +
  • Rest APIs for sending push notifications. +
      +
    1. Single request +

      With the created message field, you can construct a notification using a JSON query and send it to the RQM server using the POST method. The following list contains the details:

      • URI: URI of the RQM server chosen based on the first 2 digits of the registration ID
      • @@ -780,6 +789,259 @@ appSecret: dYo/o/m11gmWmjs7+5f+2zLNVOc=
    2. + + + + + +
    3. Multiple Request +

      You can construct a Multiple Request in a RestAPI call. The following list contains the details:

      +
        +
      • URI: URI of the RQM server chosen based on the first 2 digits of the registration ID
      • +
      • Method: POST
      • +
      • Data: JSON
      • +
      • Description: Request a notification push to a push client
      • +
      • Argument: Refer to single request
      • +
      • Note: Total request message body must be less than the system default value, 200 kb. If not, "3034 – error of too long chuned message data" is returned. System default value can be changed as needed.
      • +
      • Example header: +
        +appID: 1234567890987654
        +appSecret: dYo/o/m11gmWmjs7+5f+2zLNVOc=
        +
      • + +
      • Example request: +
        +{
        +   "messages":
        +   [{
        +      "encoding" : "base64" <!--Optional-->
        +      "regID" : "ab123456",
        +      "requestID" : "0000001",
        +      "sender" : "oscal", <!--Optional-->
        +      "type" : 0 <!--Optional-->
        +      "message" : "example", <!--Optional-->
        +      "appData" : "{id:asdf&passwd:1234}", <!--Optional, (Opaque)-->
        +      "expiryDate" : 720, <!--Optional-->
        +      "delayDate" : 60, <!--Optional-->
        +      "reliableOption" : "Transport", <!--Optional-->
        +      "sessionInfo" : "192.168.0.1-8080-12345567", <!--Optional-->
        +      "timeStamp" : 1234567890, <!--Optional-->
        +      "connectionTerm" : 0, <!--Optional-->
        +    }
        +    {
        +      "encoding" : "base64" <!--Optional-->
        +      "regID" : "ab234567",
        +      "requestID" : "0000002",
        +      "sender" : "oscal", <!--Optional-->
        +      "type" : 0 <!--Optional-->
        +      "message" : "example", <!--Optional-->
        +      "appData" : "{id:asdf&passwd:1234}", <!--Optional, (Opaque)-->
        +      "expiryDate" : 720, <!--Optional-->
        +      "delayDate" : 60, <!--Optional-->
        +      "reliableOption" : "Transport", <!--Optional-->
        +      "sessionInfo" : "192.168.0.1-8080-12345567", <!--Optional-->
        +      "timeStamp" : 1234567890, <!--Optional-->
        +      "connectionTerm" : 0, <!--Optional-->
        +   ]}
        +
        +}
        +
        +
      • + + +
      • Example response: +
          +
        • +

          The following example shows a response message when the request is successful:

          +
          +{
          +   "results":
          +   [{
          +      "regID":"ab123456",
          +      "requestID":"0000001",
          +      "statusCode":1000,
          +      "statusMsg":"Success"
          +   }
          +   {
          +      "regID":"ab234567",
          +      "requestID":"0000002",
          +      "statusCode":1000,
          +      "statusMsg":"Success"
          +   }]
          +}
          +
          +
        • +
        • +

          The following example shows a response message when the request fails due to malformation:

          +
          +{
          +   "results":
          +   [{
          +      "regID":"",
          +      "requestID":"",
          +      "statusCode":3023,
          +      "statusMsg":"error of json mapping exception"
          +   }]
          +}
          +
          +
        • +
        • +

          The following example shows a response message when some of multiple request are failed and the others are not:

          +
          +{
          +   "results":
          +   [{
          +      "regID":"ab123456",
          +      "requestID":"0000001",
          +      "statusCode":1000,
          +      "statusMsg":"Success"
          +   }
          +   {
          +      "regID":"ab234567",
          +      "requestID":"0000002",
          +      "statusCode":3008,
          +      "statusMsg":"error of not registered regID"
          +   }]
          +}
          +
          +
        • +
        +
      • +
      +
    4. + + +
    5. Multicast +

      You can construct a multicast to send a push notification to multiple applications. The following list contains the details:

      +
        +
      • URI: URI of the RQM server chosen based on the first 2 digits of the registration ID
      • +
      • Method: POST
      • +
      • Data: JSON
      • +
      • Description: Request a notification push to a push client
      • +
      • Argument: Refer to single request
      • +
      • Note: Total request message body must be less than the system default value, 200 kb. If not, "3034 – error of too long chuned message data" is returned. System default value can be changed as needed.
      • +
      • Example header: +
        +appID: 1234567890987654
        +appSecret: dYo/o/m11gmWmjs7+5f+2zLNVOc=
        +
      • + +
      • Example request: +
        +{
        +   "messages":
        +   [{
        +      "encoding" : "base64" <!--Optional-->
        +      "regID" : ["ab123456", "ab234567", "ab345678"]
        +      "requestID" : "0000001",
        +      "sender" : "oscal", <!--Optional-->
        +      "type" : 0 <!--Optional-->
        +      "message" : "example", <!--Optional-->
        +      "appData" : "{id:asdf&passwd:1234}", <!--Optional, (Opaque)-->
        +      "expiryDate" : 720, <!--Optional-->
        +      "delayDate" : 60, <!--Optional-->
        +      "reliableOption" : "Transport", <!--Optional-->
        +      "sessionInfo" : "192.168.0.1-8080-12345567", <!--Optional-->
        +      "timeStamp" : 1234567890, <!--Optional-->
        +      "connectionTerm" : 0, <!--Optional-->
        +   ]}
        +
        +}
        +
        +
      • + +
      • Example response: +
          +
        • +

          The following example shows a response message when the request is successful:

          +
          +{
          +   "results":
          +   [{
          +      "regID":"ab123456",
          +      "requestID":"0000001",
          +      "statusCode":1000,
          +      "statusMsg":"Success"
          +   }
          +   {
          +      "regID":"ab234567",
          +      "requestID":"0000002",
          +      "statusCode":1000,
          +      "statusMsg":"Success"
          +   }
          +   {
          +      "regID":"ab345678",
          +      "requestID":"0000002",
          +      "statusCode":1000,
          +      "statusMsg":"Success"
          +   }]
          +}
          +
          +
        • +
        • +

          The following example shows a response message when the request fails due to malformation:

          +
          +{
          +   "results":
          +   [{
          +      "regID":"",
          +      "requestID":"",
          +      "statusCode":3023,
          +      "statusMsg":"error of json mapping exception"
          +   }]
          +}
          +
          +
        • +
        • +

          The following example shows a response message when some of multiple request are failed and the others are not:

          +
          +{
          +   "results":
          +   [{
          +      "regID":"ab123456",
          +      "requestID":"0000001",
          +      "statusCode":1000,
          +      "statusMsg":"Success"
          +   }
          +   {
          +      "regID":"ab234567",
          +      "requestID":"0000001",
          +      "statusCode":3008,
          +      "statusMsg":"error of not registered regID"
          +   }
          +   {
          +      "regID":"ab345678",
          +      "requestID":"0000001",
          +      "statusCode":3013,
          +      "statusMsg":"error of impossible to enqueue"
          +   }]
          +}
          +
          +
        • +
        +
      • +
      +
    6. +
    + + + + + + + + + + + + + + + + + + +

    Receiving Push Notifications