2017-05-14 25 views
0

我有一个iOS和Android应用程序,部署在Parse Server中。现在,我想从云端功能中使用LiveQuery SDK!在Cloud代码中解析LiveQuery

这里是我的云代码:

Parse.Cloud.define("subscribeQueryFunction", function(request, response) { 
    var query = new Parse.Query("Message"); 
    var subscription = query.subscribe(); 

    subscription.on("create", (object) => { 
     response.success(object); 
    }); 
}); 

我的银行代码:

​​

的事情是,客户端没有得到回应!虽然,我查了日志和订阅似乎成立:

2017-05-14T16:49:12.442Z - Ran cloud function subscribeQueryFunction for user D7FP3cts5p with: Input: {} Result: {"text":"hey","createdAt":"2017-05-14T16:49:12.412Z","updatedAt":"2017-05-14T16:49:12.412Z","objectId":"DXCiumOTal","__type":"Object","className":"Message"} 2017-05-14T16:49:11.101Z - Ran cloud function subscribeQueryFunction for user D7FP3cts5p with: Input: {} Result: {"text":"hey","createdAt":"2017-05-14T16:49:11.044Z","updatedAt":"2017-05-14T16:49:11.044Z","objectId":"qkXS6csCKJ","__type":"Object","className":"Message"} 2017-05-14T16:49:09.099Z - Ran cloud function subscribeQueryFunction for user D7FP3cts5p with: Input: {} Result: {"text":"hey","createdAt":"2017-05-14T16:49:09.080Z","updatedAt":"2017-05-14T16:49:09.080Z","objectId":"ydnrDHO9AP","__type":"Object","className":"Message"} 2017-05-14T16:47:45.183Z - Create new client: 0

任何想法?

+0

? –

+0

@JulienKode因为我想为iOS和Android编写一次代码,并且没有开发人员对它进行单独编码 –

+0

哦,我明白了,但我不认为Live Query是用于服务器端的。这适用于网络套接字 –

回答

2

实时查询不能在服务器端使用。 Live Query使用网络套接字,与客户端实时交互。 但是,当你的应用有插座靠近太...所以想你需要的是如果你想用你的分析需要实时消息发送应用推送通知

  • 实现解析实况查询以获得与网络插座新的消息,当您的应用程序是开放
  • 使用推送通知,所以当你的应用有,你为什么你要做到这一点得到新的消息