Send a push notification using APN or GCM
var PushNotifications = require('machinepack-pushnotifications');
// Send a push notification using APN or GCM
PushNotifications.sendPushNotification({
message: {},
deviceToken: '5gxadhy6 6zmtxfl6 5zpbcxmw ez3w7ksf qscpr55t trknkzap 7yyt45sc g6jrw7qz',
connectionOptions: {},
type: 0,
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// OK.
success: function () {
},
});
The notification object (https://www.npmjs.com/package/apn or https://www.npmjs.com/package/node-gcm)
{}
The token device or an array of device tokens
'5gxadhy6 6zmtxfl6 5zpbcxmw ez3w7ksf qscpr55t trknkzap 7yyt45sc g6jrw7qz'
The connection options (https://www.npmjs.com/package/apn or https://www.npmjs.com/package/node-gcm)
{}
The type of push notification (0: Google, 1: Apple)
0
An unexpected error occurred.
OK.