Confirm APN Token

I have a java server side app that sends bulk push messages to apple server. Lately I have been getting multiple SSLSocketException: Connection closed by remote host OR SSLSocketException: Not working transactions.

I understand that in case of sending invalid tokens, the kernel forcibly closes the connection. I also have a feedback loop, but the bad tokens never appear in the feedback loop as they are not even accepted by the apple.

Is there any algorithm or method to know why the device token is "invalid"?

0


source to share


1 answer


Why is the device token invalid?

Assuming you have all your Apple device tokens and no dummy tokens are generated, the most likely cause of invalid tokens is the DB, which has both tokens and sandbox tokens in it.



How to determine which tokens are invalid:

You must use the extended APN format where you specify the message ID. After every message you send to Apple, you should try reading from the socket after setting the timeout to a large enough value. Apple will send you error responses for invalid tokens that indicate the message ID. This will allow you to find invalid tokens and remove them from your database. Note that you must use this method (reading responses after each long timeout message) to clear your DB. Once your DB is clean of invalid tokens, you don't want to use it, as this will make delivery of notifications very slow.

+2


source







All Articles