swift-server-community/APNSwift

How to reuse connections?

Closed this issue · 1 comments

It looks like the connection get's closed by apple after a few hours. How can we reconnect? Shouldn't this be handled by the send() method?

Something like

func send() {
    if apn.isConnected {
        // send...
        return
    }

    // Not connected anymore
    // Connect again and then send..
}

APNSwift doesn't handle reconnecting, that would be up to you.

That being said vapor/apns, and our move to AsyncHTTPClient could provide the necessary updates you need here to quietly handle reconnecting.