We have a use case where we send users a push notification if they can execute a new step. Usually these steps will be available for a couple of days. But especially in holiday season, steps might be available for 6 weeks or even longer.
APNS allows us to set a date, without limiting the duration. However, firebase cloud messaging rejects the message with "node-gcm Invalid request (400): Invalid value (3621207) for "time_to_live": must be between 0 and 2419200"
I guess for sendGCM.js the code could be changed like from this:
We have a use case where we send users a push notification if they can execute a new step. Usually these steps will be available for a couple of days. But especially in holiday season, steps might be available for 6 weeks or even longer.
APNS allows us to set a date, without limiting the duration. However, firebase cloud messaging rejects the message with "node-gcm Invalid request (400): Invalid value (3621207) for "time_to_live": must be between 0 and 2419200"
I guess for sendGCM.js the code could be changed like from this:
const ttlFromExpiry = (expiry) => expiry - Math.floor(Date.now() / 1000);
to this:
const ttlFromExpiry = (expiry) => expiry-Math.floor(Date.now()/1000) > 2419200 ? 2419200 : expiry - Math.floor(Date.now() / 1000);