Solving PushSharp.Apple Disconnect Issue
While doing a load test of a new Apple Passbook application, I suddenly saw some 200K transmissions errors from my WebApi application. Searching the web I found that a “high” rate of connect/disconnect to Apple Push Notification Service being reported as causing APNS to do a forced disconnect. While Apple does have a limit (very very high) on the number of notifications before they will refuse connections for an hour, the limit for connect/disconnect is much lower. After some playing around a bit I found that if I persisted the connection via a static, I no longer have this issue. Below is a sample of the code. Note : we disconnect and reconnect whenever an error happens (I have not seen an error yet) using Newtonsoft.Json.Linq; using PushSharp.Apple; using System; using System.Collections.Generic; using System.Security.Cryptography.X509Certificates; using System.Text; namespace RedDwarfDogs.Passbook.Engine.Notification { ...