PushSharp 3.0 Info: https://github.com/Redth/PushSharp/tree/3.0-dev#pushsharp-v30---the-push-awakens
@GeoffArmstrong are you using direct sending, like Start() send what you want then Stop() ?
In my scenario we have 10 different APN/GCM channels where we sending messages from one centralized queue. In V2 we never called Stop() and PN automatically clean internal receiving queues. Memory was pretty stable with spikes only during sending.
After migration to V4 I keep code which create all of ours 10 channels as single tones and once it created then instatly call Start(), and only in Dispose (which called only on stopping App pool) we call Stop(). Other code we kept the same. As result we faced with random message duplication + memory permanetly growing, seems PN queues never fully flushed.
PushSharp.Google.GcmServiceConnection.Send() Line 58
where var response = await http.PostAsync (Configuration.GcmUrl, content);
System.Net.WebException: Error writing request: The authentication or decryption has failed.
apnsBroker.OnNotificationFailed += (notification, aggregateEx) =>
{
aggregateEx.Handle(ex =>
{
var exception = ex as ApnsNotificationException;
if (exception != null)
{
var notificationException = exception;
var apnsNotification = notificationException.Notification;
var statusCode = notificationException.ErrorStatusCode;
LogManager.LogManager.Instance.Log(LogLevel.Error, exception.Message);
}
else
{
LogManager.LogManager.Instance.Log(LogLevel.Error, ex.Message);
}
return true;
});
};
apnsBroker.OnNotificationSucceeded += (notification) =>
{
LogManager.LogManager.Instance.Log(LogLevel.Error, "Notification Sent");
};
apnsBroker.Start();
foreach (var deviceToken in entity.DeviceTokens)
{
apnsBroker.QueueNotification(new ApnsNotification
{
DeviceToken = deviceToken,
Payload = JObject.Parse("{\"aps\":{\"badge\":1,\"sound\":\"sound.caf\",\"alert\":\"" + entity.Body + "\"}}")
});
}
apnsBroker.Stop();
}
catch (Exception e)
{
LogManager.LogManager.Instance.Log(LogLevel.Error, e.Message);
}
apnsBroker.OnNotificationFailed += (notification, aggregateEx) =>
{
aggregateEx.Handle(ex =>
{
var exception = ex as ApnsNotificationException;
if (exception != null)
{
var notificationException = exception;
var apnsNotification = notificationException.Notification;
var statusCode = notificationException.ErrorStatusCode;
LogManager.LogManager.Instance.Log(LogLevel.Error, exception.Message);
}
else
{
LogManager.LogManager.Instance.Log(LogLevel.Error, ex.Message);
}
return true;
});
};
apnsBroker.OnNotificationSucceeded += (notification) =>
{
LogManager.LogManager.Instance.Log(LogLevel.Error, "Notification Sent");
};
apnsBroker.Start();
foreach (var deviceToken in entity.DeviceTokens)
{
apnsBroker.QueueNotification(new ApnsNotification
{
DeviceToken = deviceToken,
Payload = JObject.Parse("{\"aps\":{\"badge\":1,\"sound\":\"sound.caf\",\"alert\":\"" + entity.Body + "\"}}")
});
}
apnsBroker.Stop();
}
catch (Exception e)
{
LogManager.LogManager.Instance.Log(LogLevel.Error, e.Message);
}
}