mirror of
https://gitlab.silvrtree.co.uk/martind2000/SODashServer.git
synced 2025-01-25 19:06:16 +00:00
Apple Push notifications. Trying something else. again
This commit is contained in:
parent
1e7740f9be
commit
1ea5285973
5
app.js
5
app.js
@ -268,11 +268,12 @@ app.post('/api/v1/register/ios', function(req, res) {
|
|||||||
|
|
||||||
logger.info('Sending the same notification each of the devices with one call to pushNotification.');
|
logger.info('Sending the same notification each of the devices with one call to pushNotification.');
|
||||||
var note = new apn.notification();
|
var note = new apn.notification();
|
||||||
note.setAlertText('Hello, from node-apn!');
|
var now = new Date();
|
||||||
|
note.setAlertText('Hello, from node-apn!' + now.toISOString() );
|
||||||
note.setAlertTitle('Smart Office');
|
note.setAlertTitle('Smart Office');
|
||||||
note.setBadge(1);
|
note.setBadge(1);
|
||||||
note.setSound('dong.aiff');
|
note.setSound('dong.aiff');
|
||||||
|
|
||||||
|
|
||||||
note.badge = 1;
|
note.badge = 1;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ var SOController = (function() {
|
|||||||
wsUrl = 'ws://ec2-52-50-147-81.eu-west-1.compute.amazonaws.com:8080';
|
wsUrl = 'ws://ec2-52-50-147-81.eu-west-1.compute.amazonaws.com:8080';
|
||||||
path = 'http://ec2-52-50-147-81.eu-west-1.compute.amazonaws.com/';
|
path = 'http://ec2-52-50-147-81.eu-west-1.compute.amazonaws.com/';
|
||||||
}
|
}
|
||||||
|
|
||||||
MicroEvent.mixin(bus);
|
MicroEvent.mixin(bus);
|
||||||
|
|
||||||
var iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
|
var iOS = ['iPad', 'iPhone', 'iPod'].indexOf(navigator.platform) >= 0;
|
||||||
@ -329,16 +329,16 @@ var SOController = (function() {
|
|||||||
var push = PushNotification.init({"android":{},"ios":iosConfig,"windows":{}});
|
var push = PushNotification.init({"android":{},"ios":iosConfig,"windows":{}});
|
||||||
|
|
||||||
push.on('registration', function(d) {
|
push.on('registration', function(d) {
|
||||||
console.log('Registration: ', JSON.stringify(d));
|
console.log('*PUSH* Registration: ', JSON.stringify(d));
|
||||||
$.post(path + 'api/v1/register/ios', d, function() {});
|
$.post(path + 'api/v1/register/ios', d, function() {});
|
||||||
});
|
});
|
||||||
|
|
||||||
push.on('notification', function(d) {
|
push.on('notification', function(d) {
|
||||||
console.log('Notification: ', d);
|
console.log('*PUSH* Notification: ', JSON.stringify(d));
|
||||||
});
|
});
|
||||||
|
|
||||||
push.on('error', function(e) {
|
push.on('error', function(e) {
|
||||||
console.error('Push error:', e);
|
console.error('*PUSH* Push error:', e);
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user