djacobs / PyAPNs

Python library for interacting with the Apple Push Notification service (APNs)
http://pypi.python.org/pypi/apns/
MIT License
1.22k stars 376 forks source link

Using Frame() to send multiple PNs and failure #105

Closed zacid closed 9 years ago

zacid commented 9 years ago

When using a frame to send many PNs how would I keep track when a specific PN fails? I.E. if I have a list of 1000 tokens I need to send to and a failure occurs on token number 556 how do I resume the sending of PNs by skipping 556 and continuing with 557?

Is this possible at all? I know that I can check the feedback service for invalid tokens before sending but it's not always that a token has been invalidated before sending, often another kind of error can occur to halt the send_notification_multiple process.

Any feedback would be greatly appreciated.

Thanks!

denisov commented 9 years ago

Hello, @zac156! You need to use enhanced mode to track errors. But Enhanced mode doesn't work with frames #103 #90 #92. So I guess it is better not to use frames, but track errors with Enhanced mode.

zacid commented 9 years ago

Thanks @denisov , does that mean that I'll have to send PNs one by one? Wouldn't this process prove to be quite as then I'd be opening and closing the socket connection each time I send an individual PN?

Thanks for your help so far!

jimhorng commented 9 years ago

@zac156 PyAPNs will try to RE-USE socket connection as much as possible if you are sending PN with the same instance

apns = APNs(use_sandbox=True, cert_file='cert.pem', key_file='key.pem')
...
apns.gateway_server.send_notification(token_hex, payload)
apns.gateway_server.send_notification(token_hex, payload)
apns.gateway_server.send_notification(token_hex, payload)

FYR.

djacobs commented 9 years ago

This is more of a support request than a bug, I am closing.