IOS APNS: can two notification provider servers have the same device token

Apple's documentation mentions that there are no restrictions on multiple vendor notification servers to send push notifications to iOS devices.

Is it possible that the same device token can be used in two different provider servers deployed on 2 different networks to send push notifications to the same app at any given moment.

Will Apple APNS, allow two different provider servers to use the same device key to send notifications from each to one app on the same device?

+3


source to share


2 answers


Yes, you can have multiple gateways (SNS, Urban Airship, PushIO, etc.) connected to the same platform provider (APNS, GCM, Amazon, etc.), the most important is the token / registration ID (device specific and app) and certificate if you are using APNS.

Many people ask how the feedback sent by the platform provider is handled.



Since the feedback idempotent, it should work without problems for different gateways; tokens stored on each gateway can be processed in the backend application. If, for example, APNS sends feedback to SNS saying that the endpoint is no longer valid (possibly because the user uninstalled the app), the token can be directly updated / removed from all other gateways. You can also leave it as it is and wait for the feedback sent by APNS to other gateways as they send notifications to an endpoint, and then update the list of endpoints in those gateways accordingly. The most important thing to note is that the feedback is idempotent, if the SNS sends a push notification to an endpoint and receives feedback, another gateway that sends a push notification to the same token will receive the same feedback.

+2


source


This is my experience with APNS, it is like a checklist before you start testing notification in any environment,

  • The certificates will decide whether the server can connect to the APN or not.
  • According to the certificate you have eg. dev certificate or production
    certificate, point to the appropriate APNS sandbox.

    Production Sandbox: - Hostname: gateway.push.apple.com, Port: 2195

    Development environment: - Hostname: gateway.sandbox.push.apple.com, Port: 2195

  • There is no restriction that a production certificate can only be used on one server or only on one network. The same production certificate can be used across multiple boxes or across multiple networks to send notifications to the same app on a device.

  • The most important thing is to check that the firewall is blocking the connection from your network to APNS Dev or Production. So do telnet for both production and APNS development environment. The connection should not be blocked.

  • If the firewall is blocking the connection to APNS, the server code will throw a Disconnected or Closed Connection exception when sending push notifications.

  • This is the strangest behavior I have seen with APNS and certificate, which caused me to lose 2-3 days. I have tested below depending on the case,

    • Server points to APNS Dev environment, "Production" certificate when sending APNS notifications, SOMETIMES server will throw "Closed Socket Exception".
    • Server points to APNS Dev environment, certificate is "Production", when sending APNS notifications, server logs say notification sent to APNS, but device will not receive notification.

:) If you did the wrong configuration, you should be lucky to get a "Closed Socket Exception".



If all configurations are correct (for credentials, firewalls), return the certificate and pointing to the correct APNS environment, the device will be calling the push notification. Push notification will work like a charm. It will be instant.

Hopefully this checklist is helpful in your implementation and health checks.

0


source







All Articles