Closed wkeithchau closed 4 years ago
@ninefivetwo you can also do it if you query your userIds on the server and map over the cursor and send the notifications unblocked. Instead of passing an array to your sending method, you map over the array or a Cursor. Your point is good though, not hard to implement it. I will definitely look into it very soon.
Instead of passing an array to your sending method, you map over the array or a Cursor.
Yes I agree, there are other workarounds that I can implement to get it working. From a scalability standpoint, this wouldn't work well.
I've instead had to do a lookup at Push.appCollection to get the tokens and pass them into Push.send().
I though you could just Push.send() to userIds instead of tokens. Not sure in your case why you need to map over tokens instead of users.
Your implementation of Push.send() only allow a single string to be passed in therefore only one userId can be passed per Push.send call. I just didn't want to be generating that many documents (which can have an impact on db performance) as I would be be sending basically the same notification out to many users.
Fixed in V2. The new API supports sending to userId, list of userIds, token, list of tokens, tokenId, list of tokenIds.
userId only accepts a string. The only way to achieve this at the moment is if I pass in an array of tokens myself into tokens. Which I guess is possible but I will need to look up Push.appCollection myself to find the tokens associated to the users.
Would it be easy enough to create a new field
userIds
to taken in an array of userId? You've already done something similar for token already.