You can use Cloud Code to trigger a push once an object gets updated. You most likely want to look at an afterSave
hook to send out a notification to all users involved.
However there is a gotcha with the hooks, they are limited to 3 seconds of wall clock time and depending on the amount of users you need to query for this, it might not be enough. So my suggestion is to create an entry in a special table (lets call it NotificationQueue) that gets queried by a background job, background jobs can run for up to 15 minutes.
So you will schedule a background job that "polls" this table for new events to send out the notifications for, send the notifications to the users and then remove the object from this table for example.
Some pseudo code of what my approach looks like
The afterSave hook
Parse.Cloud.afterSave("YourObjectClass", function(req) {
// Logic to check if you should really send out a notification
// ...
var NotificationObject = Parse.Object.extend("NotificationQueue");
var notification = new NotificationObject();
notification.set("recipients", [..array of user objects/ids..]);
notification.save(null, {
success: function(savedObject) {
// New object saved, it should be picked up by the job then
},
error: function(object, error) {
// Handle the error
}
});
});
The background job
Parse.Cloud.job("sendNotifications", function(req,res) {
// setup the query to fetch new notification jobs
var query = new Parse.Query("NotificationQueue");
query.equalTo("sent", false);
query.find({
success: function(results) {
// Send out the notifications, see [1] and mark them as sent for example
},
error: function(error) {
// Handle error
}
});
// ...
});
[1] https://www.parse.com/docs/push_guide#sending/JavaScript
[2] https://www.parse.com/docs/cloud_code_guide#functions-aftersave
[3] https://www.parse.com/docs/cloud_code_guide#jobs