Sending multiple Push APNS
yairvillar opened this issue · 2 comments
Hi, sorry to bother, but i can't seem to be able to send multiple push notifications via APNS.
here is the code.
def sendIos()
toPush = getAllPush('ios')
if toPush.count >= 1
APNS.start_persistence
send = []
toPush.each_with_index do |p, i|
if p["token"].length == '64'.to_i
puts 'sending IOS'
send << APNS::Notification.new(p["token"], :alert => p["text"], :sound => p["sound"])
deletePush(p["id"])
else
deletePush(p["id"])
end
end
APNS.send_notifications(send)
APNS.stop_persistence
end
end
i have no error, the code it acts like if it sent the push without a problem. but i have both devices on my hand, and none of them gt the push notification, now if ther is only one push on the send array, then it works, but if there is more than one push on the array, then it dont work at all. can you plis help me?? thanks
Ok, so the problem is, if you have a DB with produccion and dev tokens, when it sends a push tih both at the same time, it will not work, so if you have to test, and you have both producction and dev at the same time, you will have lots of problems, not, i think that this gem, should return the apns return, since i know for a fack when you connect to the aons iver by curl it does return the sending information.
Thanks in advance, and keep up the GREATE work, this gem is amazyng, for me that i use it on a production server, it works greate, and trust me it does handle more then 100.000 push notifications, you only have to divide it by 1000, since apple only support 1000 push at the same time :)
Hi @yairvillar ,
Did you success to send 1000 push to APNS?
I saw this error message "Errno::ECONNRESET: Connection reset by peer" when I try to send only about 200 devices. :disappointed:
I ask you this question because I want to find the correct number to divide the notifications before send them.
Thanks!