Pr0Ger/PyAPNs2

Please clarify - sending multiple notifications

westofpluto opened this issue · 2 comments

Suppose my server is running code that responds to various events and those events tell the server to send push notifications to various tokens at various times. So in real time, my server may want to send 1 or 2 or 20 or 200 push notifications to various tokens (various iOS devices). Because of the way the server code is structured, I will need to use the client.send_notification function instead of send_notfication_batch. My question is this: if we have some number of (token,payload) messages to send, should we loop through all those messages and create the APNsClient object each time, ie one for each message? Or is it best to create the APNsClient once and send all the messages on the same client? Please explain. Thanks.

Also, if I create a client (which opens a connection), how long can I use this client? Does it try to reconnect automatically? For example, if I create a client at the start of a server process that runs forever, waiting to get events for push notifications to send, can I sue this same client forever or will I have to manually recreate it at some point? How can I tell if I need to recreate it? Thanks

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.