-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Messaging sendAll() does not return correct feedback when there's an errorneous request #15
Comments
The I just tried with the following and got what I expected $factory = (new Factory())->withServiceAccount('/path/to/firebase_service_account.json');
$messaging = $factory->createMessaging();
$messages = [
['token' => $androidToken, 'notification' => ['title' => 'Android title']],
['token' => 'failure', 'notification' => ['title' => 'Failed title']],
['token' => $testToken, 'notification' => ['title' => 'Test title']],
];
try {
$report = $messaging->sendAll($messages);
} catch (MessagingException $e) {
echo $e->getMessage();
exit;
}
print_r([
'failures' => $report->failures()->count(),
'successes' => $report->successes()->count(),
]);
foreach ($report->failures()->getItems() as $failure) {
echo $failure->error()->getMessage().PHP_EOL;
} ⬇️
|
Running the exact same code as in your example returns an empty feedback list:
If the line with incorrect token is removed, then feedback array returns two items with their information. In both cases two notifications are being delivered. so middle line failure does affect status reporting, but not the actual send process. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
When using messaging component's
sendAll()
method to attempt sending multiple messages at once, if at least one of those messages bounces or there's an issue with FCM token, then the returnedMulticastSendReport
object is always empty.In case there are no issues with any of sub-requests, the returned
MulticastSendReport
object contains all the feedback correctly.The text was updated successfully, but these errors were encountered: