We are using OneSignal as 3rd party push service and configured it using parse-server-onesignal-push-adapter as we are sending pushes from cloud code. Normal pushes are working but scheduled pushes are not. No matter what we set to "push_time" parameter on Push.send(), pushes are sent immediately.
Working scheduled pushes
Pushes are sent immediately even if there is push_time parameter set on Parse.Push.send().
Parse.Push.send({
where: query,
data: {
"alert": "Voting complete. Click here to see the results.",
"sound": "cheering.caf",
//"badge": "Increment",
"content-available": 1,
"category": "VOTING_COMPLETE",
"qc": request.object.id
},
push_time: pushTime
}, {
success: function() {
console.log('##### PUSH OK');
},
error: function(error) {
console.log('##### PUSH ERROR');
},
useMasterKey: true
});
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;
if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}
var OneSignalPushAdapter = require('parse-server-onesignal-push-adapter');
var oneSignalPushAdapter = new OneSignalPushAdapter({
oneSignalAppId:"******************************",
oneSignalApiKey:"******************************"
});
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '',
fileKey: process.env.FILE_KEY || '******************************',
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',
verifyUserEmails: true,
emailVerifyTokenValidityDuration: 2 * 60 * 60,
preventLoginWithUnverifiedEmail: true,
publicServerURL: 'http://******************************/parse',
enableAnonymousUsers: false,
revokeSessionOnPasswordReset: true,
appName: '******************************',
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
fromAddress: 'no-reply@******************************.com',
domain: 'mg.******************************.com',
apiKey: 'key-******************************',
}
},
oauth: {
twitter: {
consumer_key: "******************************",
consumer_secret: "******************************"
}
},
push: {
adapter: oneSignalPushAdapter
}
});
var app = express();
app.use('/public', express.static(path.join(__dirname, '/public')));
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
app.get('/', function(req, res) {
res.status(200).send('Make sure to star the parse-server repo on GitHub!');
});
app.get('/test', function(req, res) {
res.sendFile(path.join(__dirname, '/public/test.html'));
});
var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});
ParseServer.createLiveQueryServer(httpServer);
This was taken from the Push Page.
https://github.com/ParsePlatform/parse-server/wiki/Push#push-adapter
However, there are a few caveats:
Does not support super high throughput since it does not employ a job queue system
Client push is not supported. You can only use masterKey to send push notifications
Delivery reports are not supported
Scheduled push is not supported
The biggest issue I see is high throughput since no job queue system.
We don't use Parse servers basic push service and its push adapter... Instead we use OneSignal and parse-server-onesignal-push-adapter. OneSignal supports scheduled pushes.
Have you pushed out more than 10k or 100k messages yet though the process of OneSignal and watched the ram/cpu usage on the parse server by chance?
Parse-Server does not support push_time. I created a "work around" to resolve this for me. See this article for more details
You should open the issue on the OneSignal adapter to support scheduled push.
when i see into databse (mlab) the push status was succeeded but i didn't receive push notification on mobile
server:heroku
database:mlab
sending via cloud code for specific user
Most helpful comment
Parse-Server does not support push_time. I created a "work around" to resolve this for me. See this article for more details