apnotic icon indicating copy to clipboard operation
apnotic copied to clipboard

Pass default topic to push notification api

Open mayank-singh opened this issue 9 years ago • 3 comments

Push notification api requires topic to be passed with the request. Can we pass default topic for notifications?

mayank-singh avatar May 06 '16 03:05 mayank-singh

This is not my understanding from what I read in the docs:

The topic of the remote notification, which is typically the bundle ID for your app. The certificate you create in Member Center must include the capability for this topic.

If your certificate includes multiple topics, you must specify a value for this header. If you omit this header and your APNs certificate does not specify multiple topics, the APNs server uses the certificate’s Subject as the default topic.

So, the topic is only needed if the certificate includes multiple topics.

That being said, how do you suggest that you pass in a default topic for notifications?

ostinelli avatar May 06 '16 17:05 ostinelli

You are correct. In my case, Certificate had more than one topic. If we can either set config for Apnotic for default topic using mattr_accessor and then use it when building headers for request or we can fetch topic for certificate like the following implementation.(1st one will be easier to implement) https://github.com/alloy/lowdown/blob/master/lib/lowdown/certificate.rb

mayank-singh avatar May 07 '16 01:05 mayank-singh

I think it makes sense to add an optional topic to Connection while keeping the per-notification override in place.

That should make it a bit more usable for people who only need to send pushes to one topic but need to specify it because the cert contains more than one.

mat avatar Sep 28 '16 09:09 mat