I'm using a Google Calendar Push Notifications in my web app. Currently, I'm able to create a notification channel with a unique id and resource id. I'm also receiving a push notification whenever any event added/edited in the calendar.
What would be the best approach for renewing/recreating channel just before expiry time with users presence? In the Database, I'm saving user id , channel id, expiry time, current channel creation time.
The Google Push Notifications API says that you can renew before the expiration; indeed, they implicitly recommend doing so:
"Currently there is no automatic way to renew a notification channel. When a channel is close to its expiration, you must create a new one by calling the watch method. As always, you must use a unique value for the id property of the new channel. Note that there is likely to be an "overlap" period of time when the two notification channels for the same resource are active."
Does PHP offer no timer mechanism? In Java, I'd note the expiration time and set a Timer
or similar to renew the notification just before hand - no need to poll the DB repeatedly for an expiration date that's not going to change...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With