How to use apnagent to send apns message to multiple device tokens?

641 views Asked by At

I'm using apnagent to send apns messages. After followed the tutorial, I didn't see anything about dealing with multiple device tokens.

I know we can do a loop easily but I want to know if there's a more efficient way to do this.

for(var i = 0; i < tokens.length; i++){
    token = tokens[i];
    agent.createMessage()
        .device(token)
        .alert('hello')    
        .send();
}

Thanks for the help.

Cheers, Mars

1

There are 1 answers

0
Careuno Merchan On

Actually I use a for loop to send multiple notifications (4000 users) and it works successfully.