解析服务器2.6.5推送通知无法正常工作

时间:2017-11-02 10:52:34

标签: parse-platform push-notification parse-server

更新:

npm install parse-server@2.4.2 --save 

解决了这个问题,现在我有兴趣让它在2.6.5上运行

我已经有了解析服务器的工作配置,推送消息还可以。 我现在有2.6.5版本。

我有这个云代码功能来测试:

Parse.Cloud.define('testPush', function (req, res) {
// Find user
var userQuery = new Parse.Query(Parse.User);
userQuery.equalTo("objectId", req.params.userId);

// Find devices associated with this user
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.matchesKeyInQuery('deviceToken', 'deviceToken', userQuery);
//pushQuery.matchesQuery('user', userQuery);

// Send push notification to query
Parse.Push.send({
    where: pushQuery,
    data: req.params.data
}, {
    useMasterKey: true,
    success: function () {
        res.success('push sent')
    },
    error: function (error) {
        res.error('push not sent')
    }
});});

我正在做这样的请求:

http --json POST 'http://example.com:1337/parse/functions/testPush' \
    'Content-Type':'application/json' \
    'X-Parse-Master-Key':'KEY' \
    'X-Parse-Application-Id':'APPID' \
    data:="{
  "alert": {
    "title": "Test Push",
    "body": "Test Body"
  },
  "code": "3"
}" 
    userId="7128712387" \
    text="Lorem ipsnum"

我的日志中没有任何错误,我只是:

0|parse-wr | verbose: RESPONSE from [POST] /parse/functions/testPush: {
0|parse-wr |   "response": {
0|parse-wr |     "result": "push sent"
0|parse-wr |   }
0|parse-wr | } result=push sent
0|parse-wr | verbose: _PushStatus bYSCE3SnvX: sending push to 1 installations
0|parse-wr | verbose: Sending push to 1
0|parse-wr | verbose: _PushStatus bYSCE3SnvX: sent push! 0 success, 1 failures
0|parse-wr | verbose: _PushStatus bYSCE3SnvX: needs cleanup devicesToRemove=[]

0 个答案:

没有答案