I want to send push notifications to thousands of mobile users. Do i need to store the registration tokens of all the users in my database ? If so how can i store it efficiently while detecting the token changes and all ? I want to send push notifications for all the users whether they are logged in or not.
I am extracting token like this
await getToken(messaging, {
vapidKey: 'vapid key',
})
.then((currentToken: any) => {
if (currentToken) {
console.log('toekn', currentToken)
// Send the token to your server and update the UI if necessary
} else {
// Show permission request UI
console.log(
'No registration token available. Request permission to generate one.',
)
}
})
.catch(err => {
console.log('An error occurred while retrieving token. ', err)
})