APNs is a remote push notification service, which is a notification that is pushed from the remote server to the client (requires networking)
First, the traditional method of acquiring data has limitations: As long as the user closes the app, it can't communicate with the app's server and get the latest data content from the server
APNs is for Apple solution to solve the problem that users can't get data from the server instantly
Whether you open or close the app, as long as it is networked, you can receive the Server Push remote notificationall of the Apple devices, in the networked state, will be connected to the Apple server long--as long as the Internet connection, has been established to connect ——— long connection role, such as time calibration, system upgrade, find My iphone and so onthe principle of APNs--the example of pushing message to Mo MoA to B send a message, at this time B is not the line, how to push the message to B's phone? First of all, the server can only be in the user does not exit the premise can interact with users, users receive messages sent by others, instant display to their own app. If the user's app is turned off, it can only be pushed to the user via Apple's APNs.The general process----B sends the message first to the silent chat server-Momo gets the chat data and sends it to Apple's APNs server, the APNS server is responsible for pushing the message to the user's phoneMo Mo's server holds each user's account information, the device's unique identity APNs how to push to a specific mobile phone specific app?————— APNs if you want to push a message to a specific app for a particular user, you need to know 1. Which device ( Unique identifier of the user device uiID)--The Momo server was obtained from the client and passed to APNs. ———— Notice that the UUID is a relatively private thing, the MO server is saved by the encrypted UUID (can't see, only Apple can decrypt) 2. Which app of this device (Momo, or QQ, to which app to push), the app's unique identity. Note: UUID and AppID by calling Apple's API, Apple encrypts it, and then to the Momo server, the Mo Mo server is saved by Devicetoken, Only Apple can decrypt the user's UUID. Apple parsing devicetoken. The number of devicetoken that is pushed to the user depends on the number of apps that the user has installed
14-Apple Remote push principle