edamov / pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
MIT License
369 stars 119 forks source link

Bugfix/connection limit #27

Closed ehuebner closed 6 years ago

ehuebner commented 6 years ago

I made a different solution for that problem. As commented in the other pull request: It is tested with sending up to 11.000 notifications. The solution sends the requests in chunks of 10 requests and waits till a chunk is finished before starting the next one. This solution is slower but does not have the problem with the abort condition.

I think it is not a good idea to use the device token as key for the returned array of responses. Most people who start to using this library want to test the performance of it and send push notifications to a number of device tokens, like i did as well. But it is not possible to test that performance with your real customer device tokens. So you need to push multiple notifications to a single device token. I spammed my device with the 11k notifications. You get some 429 from the Apple Server (~1 per 1000 requests on same device token) but it is totaly fine to discover the performance of the library and your server. To enable this i set the device token as a property of the response.

tuffz commented 6 years ago

Looks great, please merge it ;)

tuffz commented 6 years ago

Thanks, @edamov ;)