Sunday, 15 June 2014

javascript - schedule background job after save object in parse.com -


I have the following argument and implement it using a parse

1) feed the object Schedule time with schedule 2) After saving the object -> Schedule a schedule that will run on schedule on schedule 3) When feed scheduling time uses parsed installation to send push notification to feed user with feed data

My code is as follows:

  cross Skcludkbadswav ( "feed" function (request) {// schedule here}) scheduled background; // This is my cloud job code Parse.Cloud.job ("schedulePush", function (request, status) {Parse.Cloud.useMasterKey (); var query = new Parse.Query (parse.Installation); var message = {"Message": "Hello World!"} Query.each (Function (Installation) {pars.php.Send ({Where: Query, Data: {"Notice_Info": {"message": "Hello World!"}} ,}). Then (function () {console.log ("Push was sent successfully." + Message)}, function (error) {response.error ("failed to send with push error:" + error. Message);});}). Then (function () {status.success ("schedule push Successfully completed. ");}, Function (error) {status.error (" oh oh, something went wrong. "+ Error. Message);});});  

ago, change

Parse.Cloud job ("Schedulepush", function (request, condition) {

to

parse.cloud.define ("schedulepush", function (request, response) {

Because it can be a regular function (with 15-second timeout, you pay attention). This also means status.success and Status .error to response.success and response.error .

Secondly, you should be the top job :

  Pars.cloud.Beave ("Feed", Function (Request) {// Schedule background job parse here.cloud.ron ("schedulepush", function (request, response) {// handle response here}};});  

I have typed it without being able to run it, so I can turn it off on syntax or two. One idea is what you have to do.


No comments:

Post a Comment