laravel-notification-channels / fcm

Firebase Cloud Messaging (FCM) notifications channel for Laravel
https://laravel-notification-channels.com/
MIT License
495 stars 127 forks source link

Pass token to notification failed event #127

Closed MarcEspiard closed 2 years ago

MarcEspiard commented 2 years ago

This commit adds the token value to the NotificationFailed $data parameter.

Context: In our use case, we need to remove the token from our database when a notification fails due to a token being either expired or invalid. Having this value passed in the event is safer than trying to retrieve said token from database as retrieving it could be subject to race conditions at scale (example: while notification is attempted, token is updated in database by user, notification fails then deletes the new token instead of the one that actually failed)

dwightwatson commented 2 years ago

Good call, thanks

MarcEspiard commented 2 years ago

@dwightwatson No problem, if you could release at the same time that'd be great :) Thank you

dwightwatson commented 2 years ago

Easy, tagged 2.6.0