P2P-based message pushing method

By dynamically setting push endpoints and receiving endpoints in the P2P network, leveraging the versatility of each device, combining message index cache and dynamic backup switching mechanisms, the traditional message push method is solved, and the problem of slow speed and high cost when facing massive devices is achieved, efficient and reliable message push is achieved.

CN119676245APending Publication Date: 2025-03-21ZHUHAI GOTECH INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411830322.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

When facing massive devices, the traditional message push method has rapidly increased the load pressure and bandwidth consumption of servers, resulting in reduced message push speed and efficiency and high cost.

Method used

Using the P2P-based message push method, by dynamically setting the push endpoint and receiving endpoint in the P2P network, each device is used to achieve efficient and fast push of messages, and introduce a message index cache mechanism and a dynamic backup switching mechanism.

Benefits of technology

It significantly improves the speed and efficiency of message push, reduces server load and operational costs, improves the reliability and attack resistance of the system, and ensures that messages can be delivered to each target device stably and reliably.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676245A_ABST
    Figure CN119676245A_ABST
Patent Text Reader

Abstract

The invention provides a P2P (Peer-to-Peer)-based message pushing method. The P2P-based message pushing method comprises the following steps: dynamically setting a pushing endpoint and a receiving endpoint in a P2P network; the server samples and selects a push endpoint from a large number of clients in the P2P network, and sends a message packet to the selected push endpoint; the selected pushing endpoint sends the unique serial number of the received message packet to all directly connected receiving endpoints; after receiving the message serial number, the receiving end point compares the message serial number with the maximum serial number which is received and processed by the receiving end point, and if the received message serial number is greater than the maximum serial number which is received by the receiving end point, a request is sent to the corresponding push end point so as to receive and acquire complete message content; and processing and displaying the received message by the receiving end point, converting the receiving end point into a new pushing end point, and returning to execute the steps until the message covers the whole P2P network or reaches a preset propagation condition. The invention aims to realize efficient and rapid pushing of messages through a decentration mode, and reduce the pushing cost at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of message push, and in particular to a message push method based on P2P. Background Art

[0002] Message push technology, as a key bridge for real-time interaction between modern mobile applications and users, has increasingly become an indispensable functional component for various applications. With the rapid development of mobile Internet technology, the number of smart devices has exploded, which has directly led to a sharp increase in the demand for message push. The traditional message push method mainly relies on a centralized server architecture, that is, all messages need to be transferred and distributed through the server. However, when faced with a large number of devices, this model rapidly increases the server load pressure and bandwidth consumption, which seriously affects the speed and efficiency of message push, and also brings high operating costs.

[0003] In order to meet this challenge, the industry has begun to explore new message push solutions. Among them, the P2P (Peer-to-Peer) network architecture has attracted much attention due to its decentralized characteristics. In a P2P network, each device is both a client and a server, and the transmission and diffusion of messages are achieved through direct connections between nodes. This architecture can not only significantly increase the speed of message propagation, but also effectively reduce the dependence and load on the central server, thus becoming an effective way to solve the current message push problem.

[0004] However, despite the many advantages of P2P networks in the field of message push, some existing P2P-based message push systems still have some shortcomings. For example, patent number CN109936602B discloses a P2P network system based on real-time push. Although it uses the P2P network for data transmission, its main focus is on layered data transmission based on node bandwidth rather than comprehensive optimization of message push. In addition, the system does not specifically address the problems of high cost and slow speed that may occur during message push.

[0005] Specifically, the high cost problem mainly stems from the huge traffic consumption required for massive message push. In the scenario of pushing messages above one million, even if the size of each message is only 1KB, the accumulated traffic consumption is staggering, which is undoubtedly a heavy burden for the system that pushes messages frequently. The slow speed problem is mainly affected by the server processing power and bandwidth limitations. When pushing messages to a large number of devices at the same time, the server's processing power can easily reach a bottleneck, resulting in increased message push delays and reduced user experience.

[0006] In order to deal with this situation, a method is needed to speed up the push speed and reduce the push cost. P2P is a decentralized network architecture. After applying P2P, each device is both a client and a server. By spreading messages through P2P nodes, the speed of message diffusion can be increased and the server load can be reduced. Summary of the invention

[0007] In order to solve the problems existing in the prior art, the purpose of the present invention is to provide a P2P-based message push method, which aims to achieve efficient and fast message push in a decentralized manner while reducing the push cost.

[0008] The present invention achieves the above-mentioned purpose through the following technical solutions:

[0009] A message push method based on P2P, comprising:

[0010] Step S1, dynamically setting a push endpoint and a receiving endpoint in the P2P network, wherein the push endpoint and the receiving endpoint are relative roles and are dynamically determined according to the behavior of the client sending and receiving messages in the P2P network;

[0011] Step S2, the server selects a portion of the clients in the P2P network as push endpoints, and sends a message packet containing the message time, unique sequence number, message content and expiration time to the selected push endpoints;

[0012] Step S3, the selected push endpoint sends the unique sequence number of the message packet it has received to all its directly connected receiving endpoints;

[0013] Step S4, after receiving the message sequence number, the receiving endpoint compares it with the maximum sequence number it has received and processed. If the received message sequence number is greater than the maximum sequence number it has received, it requests the corresponding push endpoint to receive and obtain the complete message content;

[0014] Step S5, the receiving endpoint processes and displays the received message, and then the receiving endpoint is transformed into a new push endpoint and returns to execute steps S3 and S4 to continue to spread the message in the P2P network until the message covers the entire P2P network or reaches the preset propagation condition.

[0015] According to a P2P-based message push method provided by the present invention, in a multi-round message push process, after the push endpoint of each round pushes a message to the receiving endpoint to which it is connected, it monitors the confirmation feedback of the receiving endpoint;

[0016] When the push endpoint receives confirmation feedback from the receiving endpoint, indicating that the receiving endpoint has successfully received and processed the message, the push endpoint will update its local record to mark that the receiving endpoint has completed receiving the message;

[0017] If the push endpoint does not receive confirmation feedback from a receiving endpoint within the scheduled time, it will try to resend the message or select another path to push the message to ensure high reliability of message transmission;

[0018] The message push process is repeated in each push round until all receiving endpoints successfully receive and process the good message, or the preset number of retries and / or time limit is reached.

[0019] According to a P2P-based message push method provided by the present invention, a message index cache mechanism is introduced into the P2P network;

[0020] When a client receives a new message as a push endpoint, it first checks whether it has the index of the message cached locally;

[0021] If the index of the message has been cached, it means that the client has received and processed the message before and does not need to process it again;

[0022] If the index of the message is not cached, the client executes steps S2-S5 to process and push the message;

[0023] At the same time, after processing and pushing the message, the client will cache the index of the message locally to facilitate subsequent quick identification and processing of duplicate messages.

[0024] According to a P2P-based message push method provided by the present invention, the server selects a portion of a large number of clients in the P2P network by sampling as push endpoints, including:

[0025] Step S21, the server continuously collects and updates the connection status information of each client in the P2P network;

[0026] Step S22, the server first divides the clients according to the geographical regions where the IP addresses of the clients are located based on the collected client connection status information to form multiple regional client sets;

[0027] Step S23, for each regional client set, the server uses the connection status information collected in step S21 to perform calculations through a specified algorithm, and selects N optimal or suboptimal clients from the regional client set as push endpoints;

[0028] In step S24, the server sends a message package including the message time, unique serial number, message content and expiration time to the N push endpoints in each region screened out in step S23 to start the subsequent message push and diffusion process.

[0029] According to a P2P-based message push method provided by the present invention, in step S23, the specific calculation process of the specified algorithm includes:

[0030] Step S231, for each regional client set, the server first calculates a comprehensive score for each client in the set;

[0031] Step S232, the server sorts the clients in the regional client set according to the calculated comprehensive scores to form a score sequence from high to low or from low to high;

[0032] Step S233, the server selects the first N clients from the sorted scoring sequence as push endpoints for the region, where N is a preset positive integer representing the number of push endpoints to be selected for each region;

[0033] In step S234, the server repeatedly executes steps S231 to S233 until push endpoints are screened out for all regional client sets.

[0034] According to a P2P-based message push method provided by the present invention, the comprehensive score is weighted based on three dimensions: the number of connections, communication frequency and connection success rate of the client; wherein the weight of the number of connections is used to reflect the connectivity of the client in the P2P network, the weight of the communication frequency is used to reflect the activity of the client, and the weight of the connection success rate is used to reflect the communication stability of the client.

[0035] According to a P2P-based message push method provided by the present invention, in step S233, if the number of clients in the scoring sequence is less than N, the server can select all clients as push endpoints, or supplement sufficient push endpoints according to random selection or screening strategies based on other dimensions.

[0036] According to a P2P-based message push method provided by the present invention, in the process of message diffusion, a message sequence number and expiration time mechanism is used to avoid repeated message push and infinite propagation, wherein each message carries a unique sequence number, and the receiving endpoint determines whether it needs to request a message from the push end by comparing the sequence number, and the message is accompanied by an expiration time, and messages after the expiration will no longer be propagated.

[0037] According to a P2P-based message push method provided by the present invention, in step S1, when the network is initialized or the message push task starts, the system dynamically evaluates and selects a part of clients as initial push endpoints according to the parameters of each client;

[0038] After receiving the message sent by the message push server, the initial push endpoint selects a portion of clients in its P2P connection list as the next batch of receiving endpoints according to a preset push strategy or algorithm, and sends the message to these receiving endpoints;

[0039] After successfully receiving the message, the receiving endpoint dynamically decides whether to transform into a push endpoint based on its own resource status and network environment; if it decides to transform into a push endpoint, the receiving endpoint continues to propagate the message to its connected clients according to the preset push strategy or algorithm;

[0040] According to the real-time status of the P2P network, the number and distribution of push endpoints and receiving endpoints are dynamically adjusted to ensure that messages can be efficiently and evenly spread to the entire P2P network.

[0041] A P2P-based message push method provided by the present invention also includes a dynamic backup and switching mechanism of a push endpoint and a receiving endpoint, specifically including the following steps:

[0042] At least one standby endpoint is configured for each push endpoint and receiving endpoint. These standby endpoints are in standby or listening mode in the initial state and do not directly participate in the push and reception of messages;

[0043] During the message push process, continuously monitor the status of all push endpoints and receiving endpoints;

[0044] When an abnormal situation is detected at a push endpoint or a receiving endpoint, the backup switching process is immediately started;

[0045] According to a preset switching strategy or algorithm, a most suitable endpoint is selected from the configured standby endpoints as a new push endpoint or receiving endpoint, and the related push task or receiving task is quickly switched to the standby endpoint;

[0046] After the switch is completed, update the status information of the push endpoint and the receiving endpoint to ensure that subsequent message push can proceed smoothly, and continue to monitor the status of the new endpoint to ensure the continuity and stability of message push.

[0047] It can be seen that compared with the prior art, the present invention has the following beneficial effects:

[0048] 1. The present invention achieves exponential growth in message push by directly connecting P2P endpoints to spread messages. Compared with the traditional centralized push method, the present invention does not need to rely on a single server for message distribution, thus avoiding server performance bottlenecks and bandwidth limitations, especially when facing large-scale message push to tens of millions of devices, it can significantly improve push speed and efficiency.

[0049] 2. The present invention cleverly introduces the mechanism of serial number and expiration time to ensure the uniqueness and timeliness of each message in the P2P network. By assigning a unique serial number to each message and setting a reasonable expiration time, it can automatically identify and discard duplicate or expired messages, thereby effectively avoiding the problem of repeated message push and infinite propagation, and ensuring the accuracy and effectiveness of message transmission.

[0050] 3. The decentralized P2P architecture makes the present invention more reliable and stable. Since the message transmission does not rely on a single central server, even if some nodes fail or the network is interrupted, it will not affect the entire message diffusion process. This distributed design greatly improves the system's fault tolerance and anti-attack capabilities, ensuring that the message can be stably and reliably delivered to each target device.

[0051] 4. The present invention adopts P2P technology for message diffusion, which reduces the dependence on traditional servers, thereby reducing operating costs and maintenance complexity. At the same time, since message transmission is completed through direct connection between endpoints, without forwarding through intermediate servers, it also reduces network delay and bandwidth consumption, and improves the overall system performance.

[0052] 5. The present invention is not only applicable to traditional audio and video data transmission scenarios, but can also be widely used in various scenarios that require large-scale and rapid message push, such as IoT device management, emergency notification release, social media message push, etc. Its decentralized, efficient and reliable characteristics make the present invention have broad application prospects in various fields.

[0053] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 It is a flow chart of an embodiment of a P2P-based message push method of the present invention.

[0055] Figure 2 It is a flow diagram of a P2P-based message push method embodiment of the present invention.

[0056] Figure 3 It is a schematic diagram of the principle of a message diffusion method through connections between P2P endpoints in an embodiment of a P2P-based message push method of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0059] See also Figures 1 to 3 The present invention provides a message push method based on P2P, comprising the following steps:

[0060] Step S1, dynamically setting a push endpoint and a receiving endpoint in the P2P network, wherein the push endpoint and the receiving endpoint are relative roles and are dynamically determined according to the behavior of the client sending and receiving messages in the P2P network;

[0061] Step S2, the server selects a portion of the clients in the P2P network as push endpoints, and sends a message packet containing the message time, unique sequence number, message content and expiration time to the selected push endpoints;

[0062] Step S3, the selected push endpoint sends the unique sequence number of the message packet it has received to all its directly connected receiving endpoints;

[0063] Step S4, after receiving the message sequence number, the receiving endpoint compares it with the maximum sequence number it has received and processed. If the received message sequence number is greater than the maximum sequence number it has received, it requests the corresponding push endpoint to receive and obtain the complete message content;

[0064] Step S5, the receiving endpoint processes and displays the received message, and then the receiving endpoint is transformed into a new push endpoint and returns to execute steps S3 and S4 to continue to spread the message in the P2P network until the message covers the entire P2P network or reaches the preset propagation condition.

[0065] During multiple rounds of message push, after each push endpoint pushes a message to the connected receiving endpoint, it monitors the confirmation feedback from the receiving endpoint; when the push endpoint receives confirmation feedback from the receiving endpoint, indicating that the receiving endpoint has successfully received and processed the message, the push endpoint updates its local record and marks that the receiving endpoint has completed the reception of the message; if the push endpoint does not receive confirmation feedback from a receiving endpoint within the predetermined time, it attempts to resend the message or selects another path to push the message to ensure high-reliability transmission of the message; the message push process is repeated in each round of push until all receiving endpoints successfully receive and process good messages, or the preset number of retries and / or time limit is reached.

[0066] Specifically, Figure 3 As shown in Figure 1, the P2P network is actually a huge connection network, where each client is connected to each other, forming a many-to-many relationship. Assuming that the server in step S2 above selects endpoints A, B, and C to push messages, then in the first stage, A, B, and C will serve as push endpoints to all receiving endpoints connected to them (such as Figure 3 When the receiving endpoints in the first phase (such as b1, b2, b3) receive the above pushed messages, b1, b2, b3... will serve as the push endpoints in the second phase and continue to push new messages to all the receiving endpoints connected to them (such as d1, d2, d3...).

[0067] This process is repeated many times, and the receiving endpoint in each stage will be transformed into the pushing endpoint in the next stage, so that the message spreads outward from multiple points until it covers the entire P2P network.

[0068] In this embodiment, in order to further improve the speed and efficiency of message push, a message index cache mechanism is introduced in the P2P network:

[0069] When a client receives a new message as a push endpoint, it first checks whether the index of the message has been cached locally; if the index of the message has been cached, it indicates that the client has received and processed the message before and does not need to process it again; if the index of the message has not been cached, the client executes the steps S2-S5 to process and push the message; at the same time, after processing and pushing the message, the client will cache the index of the message locally to facilitate the subsequent rapid judgment and processing of duplicate messages. It can be seen that this message index caching mechanism can effectively avoid repeated push and processing of messages, and improve the message transmission efficiency and resource utilization of the P2P network.

[0070] In the above step S2, the server selects a portion of the clients in the P2P network as push endpoints by sampling, including:

[0071] In step S21, the server continuously collects and updates the connection status information of each client in the P2P network, including but not limited to the number of P2P endpoints connected to the client, the communication frequency with other P2P endpoints, the connection success rate with other P2P endpoints, and the geographical area where the client is located.

[0072] Step S22: Based on the collected client connection status information, the server first divides the clients according to the geographical regions where the IP addresses of the clients are located, thereby forming a plurality of regional client sets.

[0073] Step S23, for each regional client set, the server uses the connection status information collected in step S21 to calculate through a specified algorithm (such as a weighted algorithm based on the number of connections, communication frequency, connection success rate, etc.), and selects N optimal or suboptimal clients from the regional client set as push endpoints.

[0074] In step S24, the server sends a message package including the message time, unique serial number, message content and expiration time to the N push endpoints in each region screened out in step S23 to start the subsequent message push and diffusion process.

[0075] It can be seen that the server sampling process includes: continuously collecting the P2P connection status of each client (including but not limited to the number of P2P endpoints connected to the endpoint, the communication frequency with other P2P endpoints, the connection success rate with other P2P endpoints, and the region); first filtering the clients according to the region, and dividing all the clients according to the region where the IP is located; from each region, using the collected information, N clients are calculated using a specified algorithm; and pushing messages to the clients obtained in the above steps.

[0076] In the above step S23, the specific calculation process of the specified algorithm includes:

[0077] Step S231: For each regional client set, the server first calculates a comprehensive score for each client in the set.

[0078] Step S232: The server sorts the clients in the regional client set according to the calculated comprehensive scores to form a score sequence from high to low or from low to high.

[0079] In step S233, the server selects the first N clients from the sorted scoring sequence as push endpoints for the region, where N is a preset positive integer representing the number of push endpoints to be selected for each region.

[0080] In step S234, the server repeatedly executes steps S231 to S233 until push endpoints are screened out for all regional client sets.

[0081] In this embodiment, the comprehensive score is weighted based on the three dimensions of the client's connection quantity, communication frequency and connection success rate; among them, the weight of the connection quantity is used to reflect the connectivity of the client in the P2P network, the weight of the communication frequency is used to reflect the client's activity, and the weight of the connection success rate is used to reflect the client's communication stability.

[0082] The specific weighting algorithm may be, but is not limited to, linear weighted sum, product weighting, exponential weighting, etc., and the weight coefficient of each dimension may be adjusted according to the actual application scenario and requirements.

[0083] In the above step S233, if the number of clients in the scoring sequence is less than N, the server may select all clients as push endpoints, or supplement sufficient push endpoints according to random selection or screening strategies based on other dimensions.

[0084] During the message diffusion process, the message sequence number and expiration time mechanism are used to avoid repeated message push and infinite propagation. Each message has a unique sequence number. The receiving endpoint determines whether it needs to request the message from the push end by comparing the sequence number. The message also has an expiration time, and messages after the expiration will no longer be propagated.

[0085] In this embodiment, by utilizing the many-to-many connection relationship of the P2P network, a decentralized message push mechanism is constructed, in which each client can dynamically act as a push endpoint or a receiving endpoint, thereby enabling the message to spread from the initial push endpoint to the entire P2P network at an exponentially growing rate through relay transmission by multiple intermediate clients; this decentralized message push method not only improves the efficiency and speed of message push, but also reduces the dependence and load on a single message push server, thereby enhancing the scalability and robustness of the system.

[0086] Specifically, when the message push server sends the message to the initially selected push endpoints, these push endpoints will use their P2P connections with surrounding clients to quickly spread the message to more receiving endpoints; after receiving the message, these receiving endpoints will immediately become new push endpoints and continue to spread the message to their connected clients, and so on, forming a rapid and widespread spread of messages in the P2P network; through this decentralized push method, messages can cover the entire P2P network in a very short time, realizing efficient broadcast and notification functions, which is suitable for message push scenarios of large-scale devices (such as hundreds of millions).

[0087] In the above step S1, when the network is initialized or the message push task starts, the system dynamically evaluates and selects a part of clients as initial push endpoints based on parameters such as the network connection status, processing capacity, and online time of each client; after receiving the message sent by the message push server, the initial push endpoint selects a part of clients in its P2P connection list as the next batch of receiving endpoints according to a preset push strategy or algorithm, and sends the message to these receiving endpoints; after successfully receiving the message, the receiving endpoint dynamically decides whether to transform into a push endpoint based on its own resource status and network environment; if it decides to transform into a push endpoint, the receiving endpoint continues to propagate the message to its connected clients according to the preset push strategy or algorithm, such as the degree of network congestion, the response speed of the client, the push efficiency, and other factors; according to the real-time status of the P2P network, the number and distribution of push endpoints and receiving endpoints are dynamically adjusted to ensure that the message can be efficiently and evenly spread to the entire P2P network.

[0088] In this embodiment, in order to further improve the reliability and efficiency of message push, a dynamic backup and switching mechanism of the push endpoint and the receiving endpoint is also included, which specifically includes the following steps:

[0089] At least one backup endpoint is configured for each push endpoint and receiving endpoint. These backup endpoints are in standby or listening mode in the initial state and do not directly participate in the push and reception of messages. During the message push process, the status of all push endpoints and receiving endpoints is continuously monitored, including but not limited to their online status, response time, processing capacity and network connection quality. When an abnormal situation such as failure, response timeout, insufficient processing capacity or unstable network connection of a push endpoint or receiving endpoint is detected, the backup switching process is immediately started. According to the preset switching strategy or algorithm, the most suitable endpoint is selected from the configured backup endpoints as the new push endpoint or receiving endpoint, and the relevant push tasks or receiving tasks are quickly switched to the backup endpoint. After the switch is completed, the status information of the push endpoint and the receiving endpoint is updated to ensure that subsequent message push can proceed smoothly, and the status of the new endpoint continues to be monitored to ensure the continuity and stability of message push.

[0090] In summary, the present invention achieves exponential growth in message push by directly connecting P2P endpoints to spread messages. Compared with the traditional centralized push method, the present invention does not need to rely on a single server for message distribution, thereby avoiding server performance bottlenecks and bandwidth limitations, especially when facing large-scale message pushes for tens of millions of devices, it can significantly improve push speed and efficiency.

[0091] Furthermore, the present invention cleverly introduces a mechanism of serial number and expiration time to ensure the uniqueness and timeliness of each message in the P2P network. By assigning a unique serial number to each message and setting a reasonable expiration time, it can automatically identify and discard duplicate or expired messages, thereby effectively avoiding the problem of repeated message push and infinite propagation, and ensuring the accuracy and effectiveness of message transmission.

[0092] Furthermore, the decentralized P2P architecture makes the present invention more reliable and stable. Since the message transmission does not rely on a single central server, even if some nodes fail or the network is interrupted, it will not affect the entire message diffusion process. This distributed design greatly improves the system's fault tolerance and anti-attack capabilities, ensuring that the message can be stably and reliably delivered to each target device.

[0093] Furthermore, the present invention adopts P2P technology for message diffusion, which reduces the dependence on traditional servers, thereby reducing operating costs and maintenance complexity. At the same time, since message transmission is completed through direct connection between endpoints, without forwarding through intermediate servers, it also reduces network delay and bandwidth consumption, and improves the overall system performance.

[0094] Furthermore, the present invention is not only applicable to traditional audio and video data transmission scenarios, but can also be widely used in various scenarios that require large-scale and rapid message push, such as IoT device management, emergency notification release, social media message push, etc. Its decentralized, efficient and reliable characteristics make the present invention have broad application prospects in various fields.

[0095] Furthermore, this method is suitable for message push of large-scale devices (such as tens of millions). Through point-to-point diffusion technology, it improves the push speed while reducing the bandwidth and processing power requirements of the push server.

[0096] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0097] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.

Claims

1. A message push method based on P2P, characterized in that: The following steps are involved: Step S1, dynamically setting a push endpoint and a receiving endpoint in the P2P network, wherein the push endpoint and the receiving endpoint are relative roles and are dynamically determined according to the behavior of the client sending and receiving messages in the P2P network; Step S2, the server selects a portion of the clients in the P2P network as push endpoints, and sends a message packet containing the message time, unique sequence number, message content and expiration time to the selected push endpoints; Step S3, the selected push endpoint sends the unique sequence number of the message packet it has received to all its directly connected receiving endpoints; Step S4, after receiving the message sequence number, the receiving endpoint compares it with the maximum sequence number it has received and processed. If the received message sequence number is greater than the maximum sequence number it has received, it requests the corresponding push endpoint to receive and obtain the complete message content; Step S5, the receiving endpoint processes and displays the received message, and then the receiving endpoint is transformed into a new push endpoint and returns to execute steps S3 and S4 to continue to spread the message in the P2P network until the message covers the entire P2P network or reaches the preset propagation condition.

2. The method according to claim 1, characterized in that: In the process of multiple rounds of message push, after each round of push endpoint pushes a message to the connected receiving endpoint, it monitors the confirmation feedback of the receiving endpoint; When the push endpoint receives confirmation feedback from the receiving endpoint, indicating that the receiving endpoint has successfully received and processed the message, the push endpoint will update its local record to mark that the receiving endpoint has completed receiving the message; If the push endpoint does not receive confirmation feedback from a receiving endpoint within the scheduled time, it will try to resend the message or select another path to push the message to ensure high reliability of message transmission; The message push process is repeated in each push round until all receiving endpoints successfully receive and process the good message, or the preset number of retries and / or time limit is reached.

3. The method according to claim 1, characterized in that: Also includes: Introducing message index cache mechanism in P2P network: When a client receives a new message as a push endpoint, it first checks whether it has the index of the message cached locally; If the index of the message has been cached, it means that the client has received and processed the message before and does not need to process it again; If the index of the message is not cached, the client executes steps S2-S5 to process and push the message; At the same time, after processing and pushing the message, the client will cache the index of the message locally to facilitate subsequent quick identification and processing of duplicate messages.

4. The method according to claim 1, characterized in that: The server selects a portion of the clients in the P2P network as push endpoints by sampling, including: Step S21, the server continuously collects and updates the connection status information of each client in the P2P network; Step S22, the server first divides the clients according to the geographical regions where the IP addresses of the clients are located based on the collected client connection status information to form multiple regional client sets; Step S23, for each regional client set, the server uses the connection status information collected in step S21 to perform calculations through a specified algorithm, and selects N optimal or suboptimal clients from the regional client set as push endpoints; In step S24, the server sends a message package including the message time, unique serial number, message content and expiration time to the N push endpoints in each region screened out in step S23 to start the subsequent message push and diffusion process.

5. The method according to claim 4, characterized in that: In step S23, the specific calculation process of the specified algorithm includes: Step S231, for each regional client set, the server first calculates a comprehensive score for each client in the set; Step S232, the server sorts the clients in the regional client set according to the calculated comprehensive scores to form a score sequence from high to low or from low to high; Step S233, the server selects the first N clients from the sorted scoring sequence as push endpoints for the region, where N is a preset positive integer representing the number of push endpoints to be selected for each region; In step S234, the server repeatedly executes steps S231 to S233 until push endpoints are screened out for all regional client sets.

6. The method according to claim 5, characterized in that: The comprehensive score is weighted based on the three dimensions of the client's number of connections, communication frequency and connection success rate; among them, the weight of the number of connections is used to reflect the connectivity of the client in the P2P network, the weight of the communication frequency is used to reflect the client's activity, and the weight of the connection success rate is used to reflect the client's communication stability.

7. The method according to claim 5, characterized in that: In step S233, if the number of clients in the scoring sequence is less than N, the server may select all clients as push endpoints, or supplement sufficient push endpoints according to random selection or screening strategies based on other dimensions.

8. The method according to claim 1, characterized in that: During the message diffusion process, the message sequence number and expiration time mechanism are used to avoid repeated message push and infinite propagation. Each message has a unique sequence number. The receiving endpoint determines whether it needs to request the message from the push end by comparing the sequence number. The message also has an expiration time, and messages after the expiration will no longer be propagated.

9. The method according to any one of claims 1 to 8, characterized in that: In step S1, when the network is initialized or the message push task starts, the system dynamically evaluates and selects a portion of clients as initial push endpoints based on the parameters of each client; After receiving the message sent by the message push server, the initial push endpoint selects a portion of clients in its P2P connection list as the next batch of receiving endpoints according to a preset push strategy or algorithm, and sends the message to these receiving endpoints; After successfully receiving the message, the receiving endpoint dynamically decides whether to transform into a push endpoint based on its own resource status and network environment; if it decides to transform into a push endpoint, the receiving endpoint continues to propagate the message to its connected clients according to the preset push strategy or algorithm; According to the real-time status of the P2P network, the number and distribution of push endpoints and receiving endpoints are dynamically adjusted to ensure that messages can be efficiently and evenly spread to the entire P2P network.

10. The method according to any one of claims 1 to 8, characterized in that: It also includes a dynamic backup and switching mechanism for the push endpoint and the receiving endpoint, which specifically includes the following steps: At least one standby endpoint is configured for each push endpoint and receiving endpoint. These standby endpoints are in standby or listening mode in the initial state and do not directly participate in the push and reception of messages; During the message push process, continuously monitor the status of all push endpoints and receiving endpoints; When an abnormal situation is detected at a push endpoint or a receiving endpoint, the backup switching process is immediately started; According to a preset switching strategy or algorithm, a most suitable endpoint is selected from the configured standby endpoints as a new push endpoint or receiving endpoint, and the related push task or receiving task is quickly switched to the standby endpoint; After the switch is completed, update the status information of the push endpoint and the receiving endpoint to ensure that subsequent message push can proceed smoothly, and continue to monitor the status of the new endpoint to ensure the continuity and stability of message push.

Citation Information

Patent Citations

  • A P2P network system based on real-time push

    CN109936602B