I’m using the kreait/laravel-firebase package to send push notifications to a large number of users. Since I need to send notifications to a large number of device tokens, I’m trying to use the sendMulticast method and chunk the tokens to respect the Firebase limit of 500 tokens per request.
$all_data = array_chunk($recipients, 500); // Split tokens into chunks of 500
foreach ($all_data as $deviceTokens) {
$message = CloudMessage::new()
->withNotification($notification)
->withData([
'extra_data' => 'some_data',
]);
// Send the message to the chunk of tokens
$result = $messaging->sendMulticast($message, $deviceTokens);
dd($result); // Check the result for each batch
}
Showing Bellow Errors :
#message: "Operation is not implemented, or supported, or enabled."
#code: 501
#file: "C:\xampp\htdocs\sajida-fieldforce\vendor\kreait\firebase-php\src\Firebase\Exception\Messaging\MessagingError.php"
#line: 22
#errors: array:1 [▼
"error" => array:3 [▼
"code" => 501
"message" => "Operation is not implemented, or supported, or enabled."
"status" => "UNIMPLEMENTED"
]
]
You need to sign in to view this answers