Need to send notification in a batch of 1000

后端 未结 3 925
再見小時候
再見小時候 2021-01-23 23:37

I have created notification application , now i want to send notification to batch of 1000 users, but as i am new i dont know how to create that batch.

this is my code t

3条回答
  •  一生所求
    2021-01-24 00:14

    Hope it will helps you.

        // Chunk of Array with 999 Records, I have not taken risk for 1000 users :D
        // Here $array is a collection of rows which you get from Table.
        $final_array = array_chunk($array, 999);
    
        // Loop for Every Sub Array and Send to FCM Server
        foreach($final_array as $array_of_chunk) {
    
            // Your code for sending notification...
            // $registrationIds = $array_of_chunk;
    
        }
    

    You can see full code for PHP here Send Firebase Notification to more than 1000 users at a time from PHP.

    Thank you.

提交回复
热议问题