exponent-server-sdk-golang icon indicating copy to clipboard operation
exponent-server-sdk-golang copied to clipboard

Add support for multiple recipients: Error when multiple receivers but only one data

Open Zarathustra2 opened this issue 4 years ago • 2 comments

I get this error:

Mismatched response length. Expected 1 receipts but only received 3 

This happens when I send an expo message with 3 receivers. I think after #10 got merged it has been forgotten to update these lines: https://github.com/oliveroneill/exponent-server-sdk-golang/blob/266e8e6ee5ad108d87b4ca0bfd775345862e8eba/sdk/push_client.go#L121

Since the expo api will return something like this for a single message:

{
  "data": [
    {
      "status": "error",
      "message": "\"ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]\" is not a registered push notification recipient",
      "details": {
        "error": "DeviceNotRegistered"
      }
    },
    {
      "status": "ok",
      "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    }
  ]
}

So per a single message the data will be as large as the amount of tokens used.

Zarathustra2 avatar Jul 11 '20 21:07 Zarathustra2

Good catch! Feel free to make a pull request

oliveroneill avatar Jul 14 '20 11:07 oliveroneill

Hi, I am still getting the same error message when trying to use more recipients.

nikolal avatar Jan 12 '21 11:01 nikolal