Search code examples
androidiosfirebasepush-notificationapple-push-notifications

What protocol is used for mobile push notifications?


What protocol is used for mobile push notifications?

Take android as an example. First, make a HTTP request from a third-party server to the Firebase server. The question is next. How does the FIrebase server select the required mobile from many and send push notifications?

Of course, I know I can send push notifications without worrying about that. However, I am curious about interest.

On TCP / IP, IP address and MAC address are required for communication, but how do you send push notifications to mobile?

Links used for studying

thanks.


Solution

  • On iOS, when an app registers for remote notifications it receives a token. Apple stores this token against the device's actual unique identifier in their database.

    The iOS device itself maintains a persistent TCP connection to Apple's servers on port 5223. The protocol itself is proprietary to Apple.

    When a push notification is sent to Apple's servers, they cross reference the token specified in the push to determine the actual device that the push is for.

    The notification is then delivered to the device on the already established TCP connection.

    If the device isn't currently connected (say it is in Airplane mode) then the payload is held until it reconnects or the message is discarded for being too old.

    I imagine Android would work much the same