91嫩草国内在线,韩国理论电影免费看,6969精品视频在线观看,1024在线视频精品免费,色中色污,饭冈佳奈子在线
跳至內(nèi)容
Cobub文檔中心
用戶(hù)工具
登錄
站點(diǎn)工具
工具
顯示頁(yè)面
修訂記錄
反向鏈接
媒體管理器
網(wǎng)站地圖
登錄
媒體管理器
網(wǎng)站地圖
本頁(yè)面只讀。您可以查看源文件,但不能更改它。如果您覺(jué)得這是系統(tǒng)錯(cuò)誤,請(qǐng)聯(lián)系管理員。
====== User Menu of PNS ====== The document introduces usage of PNS Web interface. Here are the concepts of user channel and tag channel, which must be clarified: * user channel is named by the unique uid of mobile device. PNS will sub the uid automatically when the connection is setup (sub means join channel) * tag channel is the mobile clients group(uid group) setup by sub API. for instance, a client sub “l(fā)ocation:beijing”, then it will join into channel “l(fā)ocation:beijing”, when push messages to “l(fā)ocation:beijing”, the clients in group of “l(fā)ocation:beijing” will receive messages. Tag channel can be treated as a group for tag push. ===== Invoking the Web interface ===== Developers need to POST data to Web interface, and the Web interface will return result in JSON. If the following is configured in the file of toaster.conf: <code>[web] bind localhost:8080</code> Then you can call Web Interface using the following Linux command, or call it by programming of HTTP: <code>curl –X POST –d POST_DATA http://localhost:8080/METHOD_NAME</code> inside <code>POST_DATA is POST data to PNS METHOD_NAME is the method name to be called</code> ===== Push to a single user or multiple users(pub) ===== METHOD_NAME: pub POST_DATA: <code>"expired": "1403521931", "appid": "XXX", "channel": "xxx@qq.com", "channel": "xxx@gmail.com", "data": "hello world" </code> * expired: unix timestamp, the longest time is 30 days (setting in the configuration file above). Beyond the time specified here, PNS will discard the offline messages, and you cannot query the relevant information through the Web Interface. It is worth to noting, if “expired” is greater than 0, PNS will save offline messages for the clients offline, and will send the message when the clients log in next time. If “expired” is set to 0, it means the message is an instant one, and the PNS will not save the message for the offline clients. And the clients will not get message any more when they get online. * channel: name of user channel, you can provide multiple channels. In this method, the value of channel corresponds to UID provided by the SDK . * data: the data for clients. It supports any format data even binary data. Under normal circumstances, you can assign JSON text to data. The following lists the instruction of data format. * appid: appid of the APP to push. Only one value needed. ==== Notification Bar message template ==== If you are using the embedded presentation template in SDK, for the Notification Bar of Android, you need to use format data in POST method, refer to the JSON string as following: <code>{ "type":"notification", //notification bar type "style":"1", //notification bar style number "config":{ "icondata":"XXXXXXX", //icon file data with BASE64 encoding "vibrate":"1", //whether to vibrate when receive the message: 1 vibrating, 0 no vibrating "sound":"1", //whether to play sound: 1 sound, 0 no sound "title":"XXXXXX", //notification bar title "ticker":"XXXXXXX", //the rolling information "body":"XXXXXXX", //notification content "clickconfig":{ //define the behavior after user clicks the notification bar, please refer to the examples below "operation":"launchActivity", "package":"com.wbkit.icclient", "targetActivity":"com.wbkit.icclient.MainActivity" } } }</code> **clickconfig Example 1: open APP (Activity)** <code>{ “operation”:“l(fā)aunchActivity”, //operation type: open Activity “package” : “com.example.demo” //APK package name “targetActivity”: “com.example.demo.MainActivity” //Activity }</code> **clickconfig Example 2: download APK and install** <code>{ “operation”:“download”, //operation type: download APK “appname”: “fishing” //APP name “dlurl”: “http://xxxxxx.apk” //APK url //PS: popup installation guide of Android automatically after downloading }</code> **clickconfig Example 3: open a web page** <code>{ “operation”:“l(fā)oadWebpage”, //operation type: open a web page //PS: if both url and page are provided, the SDK will use url “url”: “http://www.baidu.com”, //url “page”: “.....” //content of page }</code> Payload message template embedded Format data as following: <code> { “type”:“transparent”, //payload type “config”:“{ “content”:“XXXXXXX”, //payload notification content } ” } </code> Format of returns from Web Interface: <code>{ "status": "200", "pushedCount": 100, "offCount": 1, "elapsed": 0.52, "mid": "489c4464de66000" } </code> * status: 200 indicates success, 400 indicates the request packet format error. * pushedCount: count of message sent. This number does not represent the number of users(devices) who received the message, it only means the server has sent data to 100 links. Only when SDK submit the receipt, the PNS server will get to know how many users(devices) received message. * offCount: the current offline count in submitted user channel. * elapsed: the consume time on the server push, in milliseconds, is a float type number. * mid: the unique ID of push task for the pushing. It can be used to query task information asynchronous, such as received count, click count, message content, and so on. ===== Push to specified one or more tag channels (tagpub) ===== tagpub is a command for the tag channel pushing, also supporting offline messages, as long as non-zero value of expired. But please note offline messages will cost more resources. If only a instant message, please set expired to 0 . METHOD_NAME: tagpub POST_DATA: "channel": "localtion:beijing", "channel": "location:guangzhou", "data": "hello world", "appid": "XXX", "expired": "1403521931" * channel: tag channel name, can be more than one channel. * data: data to send. * appid: appid associated with the tag channels, it should only be tag channels under the App. * expired: same as pub method. Returns format: { "status": "200", "pushedCount": 100, "elapsed": 0.52, "mid": "489c4465de66000" } All the returns have same meaning with pub method. ===== Push to all the users of an APP (allpub) ===== The method will push notification to online users or all users(devices) under appid. “expired” is used to distinguish online users and offline users. If expired is set 0, PNS will send data to online users, and do not save offline message. METHOD_NAME: allpub POST_DATA: "appid": "XXX", "data": "hello world", "expired": "1403521931" Returns format: { "status": "200", "pushedCount": 100, "elapsed": 0.52, "mid": "489c4466de66000" } Status description: * 200 success * 400 request packet error * 500 server internal error (usually related to redis) ===== Add uid to tag-channel (sub-tag) ===== PNS will add the uids to a certain tag channel when this interface is invoking. This method is idempotent. METHOD_NAME:sub-tag POST_DATA: "appid": "XXX", "tag": "localtion:beijing", "uid": "xxx@qq.com", "uid": "xxxx@gmail.com" Parameters description: appid: the associated appid, only one tag: the tag name to be used, also only one uid: uid to be added to the tag-channel, can be multiple Returns format: { "status": "200" } Status description: * 200 success * 400 request packet error * 500 server internal error (usually related with redis ) ===== Remove uid form tag-channel(unsub-tag) ===== METHOD_NAME: unsub-tag POST_DATA: "appid": "XXX", "tag": "localtion:beijing", "uid": "xxx@qq.com", "uid": "xxxx@gmail.com", Parameters description: appid: the associated appid, only one tag: the tag-channel name to be used, also only one uid: uid to be removed from the tag-channel, can be multiple Returns format: { "status": "200" } Status: * 200 success * 400 request packet error * 500 internal server error (usually related with redis ) ===== Push task query (message) ===== ===== User channel query (userchannel) ===== ===== Tag channel query (tagchannel) ===== ===== APP query(app-size) =====
en/toaster/user-menu-of-pns.1426833472.txt.gz
· 最后更改: 2017/07/14 11:12 (外部編輯)
頁(yè)面工具
顯示頁(yè)面
修訂記錄
反向鏈接
回到頂部
? Copyright 2012 - 2015
南京西橋科技有限公司
Western Bridge Tech Co., Ltd.
蘇ICP備13039116號(hào)-1