Closed mderazon closed 10 years ago
+1 also interested in being able to do this.
The APNS service provided by Apple does not support the sending of bulk messages, so the implementing module must handle the error and resend mechanisms needed to support (IMHO: bad design of) the APNS protocol for use in bulk. If you're interested in the details, see this article.
Lucky for you, apnagent
handles all of this for you. Your job is to make sure you listen for the proper errors so as to remove bad tokens from your bulk queue. If you collected them properly and they are accurate, you shouldn't have any problems.
Probably your largest concern when using this module is memory usage. apnagent
keeps an in-memory cache of messages sent so that, should an error occur, it can reschedule messages according to the APNS spec. If you are paranoid about such things, send in batches of 10K and wait for the queue:drain
event before scheduling the next batch. I would also look to lower cache ttl
configuration option to about a 1m
to keep things moving. Finally, I would also suggest you put a process.nextTick
or setImmediate
between each .send()
to ensure your process doesn't block. Also, at that volume, you probably want to deploy it as a separate process/service from your main application.
I have used this module primarily for transactional push messaging so I can't speak to exactly what config would work best for you, but this should get you pointed in the right direction. Please keep me posted as to your findings and if you have more specific questions, feel free to ask.
Thanks for all the info, if I try it I will keep you posted. :+1:
This library looks promising, thank you.
One question I had in mind is what's the recommended way to send push in bulk, i.e. sending the same message to 100K subscribers at the same time, preferably in one call ?
Cheers, Michael