expo-community / expo-server-sdk-python

Exponent Server SDK
MIT License
146 stars 42 forks source link

Sending same message with multiple receiptens #33

Closed emilpriver closed 3 years ago

emilpriver commented 3 years ago

Hello, Was looking at this repo to find out how to send the same message to maybe 1000 tokens at the same time without using creating a loop and building up a lot of messages, and using publish_multiple.

Is it possible to give an array of tokens to "to" in the "PushMessage" object?

julianpacker commented 3 years ago

I'm currently using a for loop that builds the same PushMessage (with a different token) and then calls publish_multiple.

I suppose it would be slightly more convenient if there were a class PushMessages which could take care of this. Or a convenient function that does this work for you. Is that the thing you're implying or did you have another idea?

emilpriver commented 3 years ago

Solved it with chunking the big array to chunks of 99 items per array. then looping thrue them and using publish_multiple to send them :D