Comments (3)
I am somewhat apprehensive to put this in the library as it doesn't promote good practice, in my opinion - and the docs do suggest this - custom payload data should be in a separate namespace. I can however appreciate your need to maintain backward compatibility with existing payload structure so I will think about how to integrate this nicely for others to use as well.
from node-apn.
Why can't you just do:
var note = new apns.Notification();
note.alert = "You have a new message";
note.device = myDevice;
note.payload.aps = {};
note.payload.aps.m = "Your custom payload";
As per lines 262-264, the aps namespace only gets created if it doesn't already exist. So you can just create it as above and put something in it. The code will then generate the stuff on top if necessary.
Unless I'm mistaken and you're trying to do something different.
from node-apn.
Just had a second look. I'm not sure what I exactly missed the last time looking at this, but you're absolutely right. I just removed the fix and crafted the notification like mentioned above. Thanks a bunch!
from node-apn.
Related Issues (20)
- 1
- Error: Socket unusable after connection. Hint: You may be using a certificate for the wrong environment HOT 1
- Deploying to Flywheel workflow failing saying inputs not valid
- ERR_CRYPTO_OPERATION_FAILED HOT 3
- High Vulnerability on node-forge-0.7.6.tgz (Vulnerable Library)
- iOS Push Notification Error: {reason: 'TopicDisallowed'} HOT 3
- How to send Communication Notifications? HOT 5
- Critical security vuln: jsonwebtoken HOT 2
- Live Activity Support
- How to use P12 files to send pushes HOT 8
- Send Push Notification To Apple Watch
- apn write failed: GOAWAY: PROTOCOL_ERROR Stream 5 does not exist HOT 1
- The future of `node-apn`
- Show In Foreground?
- Dynamically or using RESTful API to add device
- What is the right way to send a silent push notification(content-available = 1) in 2024?
- Port from http to fetch
- Is there a way to retrieve the `aps-unique-id` return header value?
- Is this package abandoned?
- is it possible to send push to multiple devices with multiple payloads using node-apn without looping?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-apn.