Closed Abrissirba closed 4 years ago
Yes, the order of responses is guaranteed to be the same as the order of input messages. This is mentioned in the documentation.
https://firebase.google.com/docs/cloud-messaging/send-message#send-a-batch-of-messages
You can query the returned BatchResponse to check how many of the messages were handed off to FCM successfully. It also exposes a list of responses that can be used to check the state of individual messages. The order of the responses corresponds to the order of the messages in the input list.
This is more of a question and something that you might want to add to the documentation. When you send many messages in batch with SendAllAsync, is the order of the responses guaranteed to be in the same order as they had in the list provided to SendAllAsync? I need to handle notifications that couldn't be sent and would therefore need the response to be in the same order as the request so that I know what error repsonse that correlates to my local notificationId.
Looking at https://github.com/firebase/firebase-admin-dotnet/blob/83222d3b44760603c5a41424e199b69eeebaff5c/FirebaseAdmin/FirebaseAdmin/Messaging/FirebaseMessagingClient.cs#L194 it seems like the responses are added to the response list in the order they arrive from BatchRequest, not honoring the index parameter.