The company I work for sends large amount of traffic to APNs on behalf of our customers, with rates up to 50k/second at peek times.
While a vast majority of the messages are successful or return a proper error code that we can parse and honor, roughly 1.5 million times per day our connections are being closed without warning.
The networking library we use, https://github.com/hyperium/h2, is exposing these as ErrorKind::ConnectionReset or ErrorKind::BrokenPipe.
From our reading of the APNs documentation, it is unclear what the correct response is when this occurs. There is no idempotency key included with our messages, so attempting to resend the message again seems frought with the potential for double sends. However, it some cases it seems clear that at least some of the messages in flight over that connection where never sent out at all.
We found this open source project unconditionally retrying messages in this case.
https://github.com/rpush/rpush/pull/734
Could someone from the APNs team please lay out the expected behavior a client should have when our connection is unexpected closed in this manner?