如何使用Parse节点sdk发送推送通知?

时间:2016-05-06 21:52:15

标签: node.js parse-platform

我目前使用parse_rest在Python中使用此代码,它可以工作:

Push.alert({
    'foo': 1,
    'bar': 2
}, where={'special_condition': true})

如何使用the Javascript library在node.js中编写等效代码?像这样的东西? (在coffeescript中)

query = new Parse.Query(Parse.Installation)
query.equalTo('special_condition', true);
Parse.Push.send
  data: 'foo': 1, 'bar': 2
  where: query

1 个答案:

答案 0 :(得分:0)

这对我有用:

query = new Parse.Query(Parse.Installation)
query.equalTo('special_condition', true)
data = { 'foo': 1, 'bar': 2 }

success = -> console.log "push was successful"
error = (e) -> console.error e

Parse.Push.send({ data: data, where: query }, success: success, error: error)