IOS message pushing method and system
1. An IOS message pushing method, comprising:
after the equipment information and the user information registered by the user are stored in the node server, the central server acquires the equipment information and the user information to generate a unique identification code, and the unique identification code is added to the pre-push message;
adding a timestamp to the pre-push message, storing all the pre-push messages into a message queue, taking out the pre-push message from the message queue by the node server in real time, and analyzing and verifying the unique identification code in the pre-push message;
and the node server calls the APNS service to send the pre-push message to the corresponding user equipment through long connection according to the unique identification code.
2. The method of claim 1, wherein the user information at least comprises push right information.
3. The method of claim 1, wherein the central server obtaining the device information and the user information to generate the unique identification code further comprises:
the central server classifies the equipment according to the equipment information and the user information registered by the client, and adds the classification identifier to the unique identification code, so that the node service judges whether the node service is sent to the user equipment according to the classification identifier.
4. The method of claim 3, wherein determining whether to send the node service to the user equipment according to the class identifier comprises:
the node server acquires the equipment information and the user information in real time, and judges whether to push the pre-push message issued by the central server or not according to the latest acquired equipment information and user information and the classification identification.
5. The method of claim 1, wherein the node server fetching the pre-push message from the message queue in real-time comprises:
and the node server takes out the pre-push message according to the timestamp, the priority and the push range of the pre-push message, and calls the APNS service to push the pre-push message.
6. The method of claim 1, wherein parsing and verifying the unique identification code in the pre-push message comprises;
and the node server analyzes the equipment information and the user information in the unique identification code, compares the equipment identification and the user identification with the equipment information and the user information stored in the node server, and verifies whether the pre-push message is wrong.
7. The method of claim 1, wherein the node server invoking the APNS service to send the pre-push message to the corresponding user equipment over the long connection according to the unique identification code further comprises;
after the message is pushed, the node server acquires user data in real time in a user authorization range, analyzes the state of an application program based on the user data and judges whether the user processes items corresponding to the pushed message;
and if the corresponding matters are not processed, requesting the central server to regenerate the push message or generating the push message by the node server.
8. An IOS message pushing system, comprising:
the central server side is used for storing the equipment information and the user information registered by the user to the node server, acquiring the equipment information and the user information to generate a unique identification code, adding the unique identification code to the pre-push message, adding a timestamp to the pre-push message, and storing all the pre-push messages to a message queue;
and the node server side is used for taking out the pre-push message from the message queue in real time, analyzing and verifying the unique identification code in the pre-push message, and calling the APNS service to send the pre-push message to the corresponding user equipment through long connection according to the unique identification code.
9. The system of claim 8, wherein the node server fetching the pre-push message from the message queue in real-time comprises:
and the node server takes out the pre-push message according to the timestamp, the priority and the push range of the pre-push message, and calls the APNS service to push the pre-push message.
10. The system of claim 8, wherein the node server side comprises:
the push analysis module is used for acquiring user data in real time in a user authorization range by the node server after pushing based on the message, analyzing the state of the application program based on the user data and judging whether the user processes the items corresponding to the push message or not;
and the re-pushing module is used for requesting the central server to regenerate the pushing message or generating the pushing message by the node server if the corresponding item is not processed.
Background
In order to improve user experience, the running state of the background program is known on the premise that the user does not open the APP, and the method can be generally realized by pushing corresponding messages through an application program server. However, since the IOS system service is not open source, the APP service provider needs to effectively distinguish the pushed messages before invoking the IOS push service. When the APP user quantity is large and the types of the messages to be pushed become more, the server side is easy to overload to reduce the message pushing efficiency in order to avoid message pushing errors.
Disclosure of Invention
In view of this, embodiments of the present invention provide an IOS message pushing method and system, so as to solve the problem of low message pushing efficiency caused by an excessive load on a server.
In a first aspect of the embodiments of the present invention, a method for pushing an IOS message is provided, including:
after the equipment information and the user information registered by the user are stored in the node server, the central server acquires the equipment information and the user information to generate a unique identification code, and the unique identification code is added to the pre-push message;
adding a timestamp to the pre-push message, storing all the pre-push messages into a message queue, taking out the pre-push message from the message queue by the node server in real time, and analyzing and verifying the unique identification code in the pre-push message;
and the node server calls the APNS service to send the pre-push message to the corresponding user equipment through long connection according to the unique identification code.
In a second aspect of the embodiments of the present invention, an IOS message pushing system is provided, including:
the central server side is used for storing the equipment information and the user information registered by the user to the node server, acquiring the equipment information and the user information to generate a unique identification code, adding the unique identification code to the pre-push message, adding a timestamp to the pre-push message, and storing all the pre-push messages to a message queue;
and the node server side is used for taking out the pre-push message from the message queue in real time, analyzing and verifying the unique identification code in the pre-push message, and calling the APNS service to send the pre-push message to the corresponding user equipment through long connection according to the unique identification code.
In the embodiment of the invention, the central server generates the unique identification code, adds the unique identification code to the pre-push message, stores all the generated pre-push messages in the message queue, and the node server takes out the pre-push message from the message queue in real time and calls the APNS service to carry out push processing. Based on the cooperation of the central server and the node server, the load of the server can be effectively reduced, the message pushing efficiency can be improved, the message pushing time delay can be reduced, and the accurate pushing of the message can be guaranteed.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating an IOS message pushing method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating an IOS message pushing method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "comprises" and "comprising," when used in this specification and claims, and in the accompanying drawings and figures, are intended to cover non-exclusive inclusions, such that a process, method or system, or apparatus that comprises a list of steps or elements is not limited to the listed steps or elements. In addition, "first" and "second" are used to distinguish different objects, and are not used to describe a specific order.
It can be understood that, as shown in fig. 1, the central server 110 and the node server 120 are both application servers, the central server 110 is configured to generate the pushed messages in a unified manner, and after the node server 120 acquires the pushing task from the central server 110, the node server may directly generate the messages for pushing if necessary, and call the SPNS service 130 provided by the IOS system to push the messages to the client 140 of the user equipment, so as to implement pushing of the messages. Based on the cooperation between the central server 110 and the node server 120, the message pushing efficiency can be improved and the pushing delay can be reduced for pushing massive messages.
Referring to fig. 2 specifically, fig. 2 is a schematic flowchart of an IOS message pushing method according to an embodiment of the present invention, including:
s101, after equipment information and user information registered by a user are stored in a node server, a central server acquires the equipment information and the user information to generate a unique identification code, and the unique identification code is added to a pre-push message;
the device information is related information of a terminal device used by a user, and comprises related hardware information such as a device model and an identification code of the terminal device, the user information is user information registered when the user uses the APP, generally comprises a mobile phone number, a social account number or a mailbox, and can also comprise basic identity information of the user, such as gender, age and the like. Wherein, the user information at least comprises push authority information. The push authority can be divided into foreground push authority, background push authority and push information category authority.
When a user uses an application program, a server needs to acquire certain device information and user information so as to ensure that a push message can be accurately sent to the user and ensure the accuracy of push content. The obtained device information and the user information are generally stored in the node server, and are obtained by the central server when the central server needs to push messages, and the node server can also automatically report the devices needing to push messages to the central server. The node server is generally a server with the least number of hops or a server that manages a certain area.
The unique identification code is the identification code of each pre-push message, occupies a specific field in the data message, and can be forwarded along with the data message (containing the content of the push message). The unique identification code may be calculated by a specific algorithm, such as a hash algorithm, and may specifically be composed of a device identifier, a user identifier, and a specific classification identifier.
Preferably, the central server classifies the devices according to the device information and the user information registered by the client, and adds the classification identifier to the unique identification code, so that the node service can judge whether to send the device to the user device according to the classification identifier.
Further, the node server acquires the device information and the user information in real time, and judges whether to push the pre-push message issued by the central server or not according to the latest acquired device information and user information and by combining the classification identifier.
And if the unique identification code generated by the central server contains the classification identification, the node server judges whether to push the message or not according to the classification identification. Because there is a delay in network message pushing and data transmission, if there is a possible error in the node server directly pushing according to the classification identifier, if the user is notified of upgrading the APP, if the central server learns that the client is not updated, the node server pushes a message to notify the user, and at this time, the node server learns that the user is updated, and the node server can determine that the message is not pushed in combination with the newly acquired information.
S102, adding a timestamp to the pre-push message, storing all the pre-push messages into a message queue, taking out the pre-push message from the message queue by the node server in real time, and analyzing and verifying a unique identification code in the pre-push message;
the time stamp is used for recording the generation time of the push message, and when the message is pushed, the node server can preferentially select the message to be pushed according to the time stamp, so that the message is ensured to be pushed in order, and the message pushing time delay is reduced. The message queue stores messages to be pushed, the types of the messages to be pushed are different, the generation time is different, and the node server can extract the messages to push according to the time sequence or the message importance degree and the like.
Preferably, the node server invokes an APNS service to perform push processing on the pre-push message according to the timestamp, the priority and the push range of the pre-push message. For the pre-push messages in the message queue, each node server can synchronously acquire the pre-push messages, when the messages are extracted, the pre-push messages can be extracted according to the priority, the timestamp, the push range and the like, if the pre-push messages are preferentially selected with high priority, the time for putting the messages is determined based on the timestamp, the longer the putting time difference is, the preferential selection is needed, the message push time delay is reduced, and finally the push range, the moon of the push range and the time required for processing by the node servers are required to be considered.
The node server analyzes the equipment information and the user information in the unique identification code, compares the equipment identification and the user identification with the equipment information and the user information stored in the node server, and verifies whether the pre-push message is wrong. When the message is verified, the node server can only compare the equipment identifier with the user identifier, so that whether the message is wrong or not can be verified, the pushed user can be confirmed, and the message pushing error is avoided.
And S103, the node server calls the APNS service to send the pre-push message to the corresponding user equipment through long connection according to the unique identification code.
The APNS service is a message pushing service provided by the IOS system, the APNS allows the user equipment and the apple server to keep a constant connection state, and the APNS server verifies the device token (equipment identification identifier) sent by the application server to realize message pushing.
Preferably, after the message is pushed, the node server acquires user data in real time within the user authorization range, analyzes the application program state based on the user data, and judges whether the user processes the items corresponding to the pushed message; and if the corresponding matters are not processed, requesting the central server to regenerate the push message or generating the push message by the node server.
The node server may obtain the user application related data within the user authorization range, for example, after the node server pushes the application update notification, if the resource update request sent by the user is obtained and the resource downloading is completed, it may be determined that the user application update is completed, or whether the update of the APP version directly obtained by the node server after the application update is completed is determined. If the update is not completed, the notification may be pushed again after a period of time.
According to the method provided by the embodiment, the message generated by the central server is placed in the message queue, and the node server extracts the message for pushing, so that the message processing efficiency can be improved, the message pushing time delay can be reduced, and the pushing error can be avoided. The node server can carry out specific processing according to the classification of the messages to be pushed, guarantee accurate pushing of the messages, and meanwhile can judge whether the messages are successfully pushed or not, so that further processing is facilitated.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, but should not constitute any limitation to the implementation process of the embodiments of the present invention,
in an embodiment of the present invention, there is further provided an IOS message pushing system, including:
the central server side is used for storing the equipment information and the user information registered by the user to the node server, acquiring the equipment information and the user information to generate a unique identification code, adding the unique identification code to the pre-push message, adding a timestamp to the pre-push message, and storing all the pre-push messages to a message queue;
wherein, the user information at least comprises push authority information.
Optionally, the central server classifies the device according to the device information and the user information registered by the client, and adds the classification identifier to the unique identifier code, so that the node service determines whether to send the device to the user device according to the classification identifier.
The node server acquires the equipment information and the user information in real time, and judges whether to push a pre-push message issued by the central server or not according to the latest acquired equipment information and user information and the classification identification.
And the node server side is used for taking out the pre-push message from the message queue in real time, analyzing and verifying the unique identification code in the pre-push message, and calling the APNS service to send the pre-push message to the corresponding user equipment through long connection according to the unique identification code.
Preferably, the node server takes out the pre-push message according to the timestamp, the priority and the push range of the pre-push message, and invokes the APNS service to perform push processing on the pre-push message.
Specifically, the node server analyzes the device information and the user information in the unique identification code, compares the device identification and the user identification with the device information and the user information stored in the node server, and verifies whether the pre-push message is wrong.
Preferably, the node server side includes:
the push analysis module is used for acquiring user data in real time in a user authorization range by the node server after pushing based on the message, analyzing the state of the application program based on the user data and judging whether the user processes the items corresponding to the push message or not;
and the re-pushing module is used for requesting the central server to regenerate the pushing message or generating the pushing message by the node server if the corresponding item is not processed.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
It is understood that, in one embodiment, the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program executes steps S101 to S103 in the first embodiment, and the processor implements IOS message pushing when executing the computer program.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by instructing the relevant hardware through a program, where the program may be stored in a computer-readable storage medium, and when executed, the program includes steps S101 to S103, and the storage medium includes, for example, ROM/RAM.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:基于多维度分析的视频推荐方法