這是本文檔舊的修訂版!
The document introduces usage of PNS Web interface.
Here are the concepts of user channel and tag channel, which must be clarified:
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:
[web]
bind localhost:8080
Then you can call Web Interface using the following Linux command, or call it by programming of HTTP:
curl –X POST –d POST_DATA http://localhost:8080/METHOD_NAME
inside
POST_DATA is POST data to PNS
METHOD_NAME is the method name to be called
Push to a single user or multiple users(pub)
METHOD_NAME: pub
POST_DATA:
"expired": "1403521931",
"appid": "XXX",
"channel": "xxx@qq.com",
"channel": "xxx@gmail.com",
"data": "hello world"
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.
Push to specified one or more tag channels (tagpub)
Push to all the users of an APP (allpub)
Add uid to tag-channel (sub-tag)
Push task query (message)
User channel query (userchannel)
Tag channel query (tagchannel)
APP query(app-size)