PerfectlySoft / Perfect-Notifications

Apple Push Notifications (APNs) Server-Side library.
https://www.perfect.org
Apache License 2.0
115 stars 30 forks source link

Refresh APNS Connection #11

Open bisikli opened 5 years ago

bisikli commented 5 years ago

Hello,

APNS service has a known. bug that, if you send a request in a session which stays idle for a while, APNS service returns an internal server error such that : "500 Internal Server Error: Unable to write frame"

Other push services overcome this problem by refreshing their APNS connections when they encounter this kind of a problem. (for example: https://github.com/relayrides/pushy/pull/529)

Is there a way to refresh connection in Perfect Notifications?

kjessup commented 5 years ago

When it goes to send msgs to an existing connection, the library will first try a PING to ensure the connection is still good. If it's not it will open a new one.

https://github.com/PerfectlySoft/Perfect-Notifications/blob/master/Sources/PerfectNotifications/NotificationPusher.swift#L305

Verify that you are using the latest tagged version, 3.0.4. If you are up to date and still seeing this issue then any further information you can provide would be helpful.