Multiple Push-Registrations for one Channel

865 views Asked by At

Can someone give me a reason why I can have mor than one registraiontId for a push-notification-channel? What's the purpose on this?

I have read so many articles about handling push-notifications (I use azure services), but I didn't find a reason. I know, the channel can change over time and then I need to change the channel on my registration-id per device on my backend).

Following method seems to be loading more than one registration. Why?

await HubClient.GetRegistrationsByChannelAsync("<pnsHandle>", 100)

Or in other words: What's the main difference between the channel and a registration?

I am a little bit confused about that... Thanks

1

There are 1 answers

0
Baris Akar On BEST ANSWER

Channel vs Registration

The "channel" is the handle between a device and the corresponding push notification service (e.g. APNS for iOS). Think of a "channel" as representing the device.

The "registration", or to be more precise the "Azure Notification Hub registration", contains data to address and manage devices that can receive push notifications via a channel.

You can only have one channel for a specific app on a specific device, but you can have multiple registrations for the same app on that device via that channel.

Why Have Multiple Registrations?

You don't have to have multiple registrations per channel. But, below are some reasons why you might decide to.

One use case is, for example, to have multiple template registrations for one device with specific templates for different notifications. You can distinguish these registrations by tags then.

For example, one device/channel might have specific template registrations for the following notifications for a social network app:

  • Friend request (template parameters: friend name)
  • Chat message (template parameters: sender name, chat message)
  • Status update (template parameters: friend name, status update)

Another use case would be to have one registration for each service that wants to send push notifications to your app.

You can only have one channel for a specific app on a specific device, but you can have multiple registrations for the same app on that device, where each registration is managed and used by another service.