I have an iOS and android application, deployed in a Parse Server. Now, I want to use the LiveQuery SDK, from a cloud function!
Here's my cloud code:
Parse.Cloud.define("subscribeQueryFunction", function(request, response) {
var query = new Parse.Query("Message");
var subscription = query.subscribe();
subscription.on("create", (object) => {
response.success(object);
});
});
And my Swift code:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
PFCloud.callFunction(inBackground: "subscribeQueryFunction", withParameters: nil) { (res: Any?, e: Error?) in
print(res)
print(e)
}
}
The thing is, that the client doesn't get a response! Although, I checked the logs and the subscription seems to be established:
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
Any ideas?