Search code examples
c#push-notificationfirebase-cloud-messagingapple-push-notificationsazure-notificationhub

NotificationHub: What happens if duplicate installations are created with the same PNS handle?


Suppose that I create an installation with NotificationHub like so:

var installation = new Installation
{
    InstallationId = installationId,
    PushChannel = pnsHandle
};

await NotificationHubClient.CreateOrUpdateInstallationAsync(installation);

and run two consecutive executions with the following values:

First:

InstallationId => A

PushChannel => X

Second:

InstallationId => B

PushChannel => X

Will Azure remove the first installation and overwrite it by the second? Therefore, Installation A will no longer exist?


Solution

  • Notification Hub will allow you to create multiple installations with the same PushChannel. It will ultimately create two separate installations.

    One caveat though, when creating a push to send to those devices, Notification Hub will de-duplicate based on the PushChannel, so it will actually detect that those are the same device and intentionally not send a duplicate push to the user.

    I hope that helps!