What is the correct way to use the c# Azure Notification Hub Client?
We are using this in a very high usage server sending millions of pushes a day.
I would like to know if we should recreate the NotificationHubClient
every time or if we should keep a static/singleton instance of it and then reuse that each time?
/// <summary>
/// Get refence to the azure hub
/// </summary>
/// <returns></returns>
private static NotificationHubClient GetHub(NotificationHub nhub, bool enableTestSend = false)
{
return NotificationHubClient.CreateClientFromConnectionString(nhub.EndPoint, nhub.HubName, nhub.AllowDiagnosticSend && enableTestSend);
}
Currently, we recreate it every time we send a push notification. However, I know from personal experience we have had issues with the .net HTTP client and it not releasing tcp sockets fast enough. I was worried that this library could start having similar issues.