Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
I have seen other APNs implementations that support connection pooling. See https://github.com/ileitch/rapns/wiki/Why-open-multiple-connections-to-the-APNs%3F.
Has PushSharp considered supporting pools?
It already does. By default, PushService does autoscaling of connections based on how long notifications sit in the queue before being sent. If they sit too long, another connection to APNs is added. If they are going very fast, consistently, a connection is closed (if there's more than one open). You can also override this default behaviour by passing in an instance of PushServiceSettings to the StartApplePushService() method (the same pattern applies for other platforms). With the PushServiceSettings you can turn autoscaling off completely, and dictate exactly how many connections the service will open to APNs.
On another note, I'm well aware of Apple's terrible implementation of their protocol, and how they only send an error response if there was a problem (it would be great if they sent a success response too), and even then, it may not come immediately. I spent a long time developing a solution around this where I keep track of all notifications I have written to the stream, and in the event of Apple sending an error response, I requeue all notifications that were sent after the notification Apple has sent us an error response for (since they ignore any notification sent after one that caused an error, even though we can send it to them and never receive additional errors for them, as they will close the connection on us after responding with the first error).
This technique took some time and effort to implement (and a lot of testing), but I believe it is now quite stable and works very well. This way we don't pause and wait after every message we send, meaning we get a much higher throughput of sent notifications over a single connection. I've never seen another library implement it the way I have, they all seem to pause after each notification which I can't help but think is horribly inefficient (even if its really apple's fault that they have to resort to this).
I hope that answers your question!