In-station message pushing method and system
By establishing a long connection on the active page and setting message response time according to the page weight, efficient and accurate message push is achieved, the problems of low resource utilization and high server pressure in the existing technology are solved, and the system performance and user experience are improved.
Patent Information
- Application Number
- CN202411656727.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-02-28
AI Technical Summary
The existing on-site message push solutions have problems with low resource utilization and high server pressure, especially in high concurrency environments, which are difficult to meet the message push needs.
By establishing a long connection when judging that the current page is an active page, and determining the message response time based on the page's design weight, periodically pushing the message, and updating the message status after the push is completed, disconnecting the long connection. Disconnect long connections to avoid unnecessary resource consumption when the page switches from the active page to the hibernate page.
It significantly reduces the use of server connection resources, alleviates server pressure, improves the system's resource utilization and push efficiency, and enhances user experience and high availability of the system.
Smart Images

Figure CN119537698A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of message push, and in particular to a method for pushing in-station messages and an in-station message push system. Background Art
[0002] In the field of in-site message push, existing technologies usually use polling, iframe streaming, server-sent events (SSE, Server-Sent Events) or Websocket to transmit messages. However, these methods face certain bottlenecks and limitations in practical applications.
[0003] The traditional polling scheme is that the client initiates a request to the server at a specified time interval and obtains unread messages in real time. Although it simply implements message push, due to the fixed push frequency, even if no new messages are generated on the server, the client will continue to request, resulting in high server pressure and serious bandwidth waste. Especially when the number of users is large, the server performance is greatly reduced. The iframe streaming method embeds a hidden iframe tag in the page to achieve a long connection between the client and the server. However, this method will display an unfinished loading status on the browser, which has a negative impact on the user experience and has poor browser compatibility.
[0004] SSE technology establishes a one-way connection between the server and the client through the HTTP protocol, realizing streaming transmission of data. However, the stateless property of the routing address of SSE causes the risk of message loss or duplication. Although some methods try to introduce a state management mechanism to solve this problem, it brings the problem of increased design complexity, increased system maintenance difficulty and resource consumption. The Websocket protocol implements full-duplex communication on a TCP connection, allowing the server to establish a persistent connection with the client and transmit data in both directions. Although it realizes efficient real-time communication, it needs to maintain the connection status for each client, which increases the management cost of the number of connections. Especially when a large number of clients are online at the same time, it may cause server overload and message loss or duplication.
[0005] In the existing technology, there is still little research on the optimization of SSE and Websocket protocols in terms of long connections and real-time push, and there is a lack of in-depth analysis of the impact of connection number control and page response time. The existing methods fail to perform adaptive regulation based on page weight and user usage data, and have low resource utilization, making it difficult to meet the message push requirements in a high-concurrency environment. The server is under great pressure, and both system stability and user experience need to be improved. Summary of the invention
[0006] The purpose of the embodiments of the present application is to provide a method and system for pushing in-site messages to solve the problems of low resource utilization and high server pressure in existing in-site message push solutions.
[0007] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a method for pushing in-site messages, including: when it is determined that the current page is an active page, establishing a long connection between the current page and the backend; identifying the design weight of the current page, and determining the message response time of the current page based on the design weight; wherein the design weight of the current page is determined based on the coupling of various message push indicators of the current page; based on the established long connection, according to the determined message response time, performing a message push operation according to a predetermined period, and after completing the message push, marking the status of the pushed message as pushed in response to a trigger signal that the current page switches from an active page to a dormant page, disconnecting the long connection between the current page and the backend.
[0008] In an embodiment of the present application, the rule for determining whether the current page is an active page is as follows: if the user stays on the current page and the stay time on the current page exceeds a preset stay time threshold, the current page is determined to be an active page; conversely, if the user does not stay on the current page, or the stay time on the current page does not exceed the preset stay time threshold, the current page is determined to be a dormant page.
[0009] In an embodiment of the present application, the rules for establishing a long connection between the current page and the back end are as follows: based on a long connection establishment request sent by the front end to the back end, a long connection between the current page and the back end is established based on SSE technology, and the long connection status is determined; if the long connection status is a connection failure, the long connection between the current page and the back end is re-established until the long connection status between the current page and the back end is a successful connection, or the preset number of retries is reached; if the preset number of retries is reached and the long connection status between the current page and the back end is still a connection failure, the front end closes the long connection establishment request.
[0010] In an embodiment of the present application, identifying the design weight of the current page includes: matching the design weights of corresponding message push indicators in a pre-built weight library based on the unique identifier of the current page; wherein the message push indicators include: one or more of the basic weight indicator of the page, the pressure level indicator of the business corresponding to the page, and the message push frequency indicator of the page.
[0011] In an embodiment of the present application, determining the message response time of the current page based on the design weight includes: generating the message response time of the current page based on the design weight of each matched message push indicator and the preset basic message response time corresponding to each message push indicator, and the generation rule is:
[0012]
[0013] Where t is the message response time of the current page; t iis the preset basic message response time of the i-th message push indicator; w i is the design weight of the i-th message push indicator; n is the number of message push indicators.
[0014] In an embodiment of the present application, the construction rules of the weight library are as follows: historical message push information is collected, and the historical message push information is classified based on each message push indicator to obtain a historical message push information set corresponding to each message push indicator; an initial weight is determined for each message push indicator, and user usage data is counted based on the corresponding historical message push information set, and each initial weight is updated based on the statistical results as the design weight corresponding to each message push indicator; a weight library is constructed based on the design weight of each message push indicator and the preset basic message response time corresponding to each message push indicator.
[0015] In an embodiment of the present application, the user usage data includes: any one or more of page dwell time, message response speed, user click rate and message response frequency; the user usage data is counted based on the corresponding historical message push information sets, and the initial weights are updated based on the statistical results, including: performing data preprocessing on each historical message push information set, and counting the changing trends of the corresponding message push indicators based on the preprocessed historical message push information sets; allocating weights of the corresponding message push indicators based on the changing trends of the message push indicators, and updating the initial weights based on the allocation results.
[0016] In an embodiment of the present application, based on the established long connection and the message response time, messages are pushed periodically, and the message status is updated after each message push, including: based on the message response time, a new message query is executed in the database every time a message response time is separated, and new messages with a message status of not pushed are treated as new messages to be pushed, and corresponding new message push is executed based on the long connection; after completing the new message push, the message status of the corresponding new message is modified in the database to pushed.
[0017] In an embodiment of the present application, in response to a trigger signal for the current page to switch from an active page to a dormant page, disconnecting the long connection between the current page and the back end includes: when the current page switches to the back end, determining that the current page triggers a trigger signal for switching from an active page to a dormant page; in response to a trigger signal for the current page to switch from an active page to a dormant page, the front end stops sending a long connection establishment request to the back end, and the long connection between the current page and the back end is disconnected.
[0018] According to a second aspect of the present application, there is provided an in-site message push system, the system comprising: a connection unit, for establishing a long connection between the current page and the backend when the current page is determined to be an active page; a processing unit, for identifying the design weight of the current page, and determining the message response time of the current page based on the design weight; wherein the design weight of the current page is determined based on the coupling of various message push indicators of the current page; a message push unit, for performing a message push operation at a predetermined period based on the established long connection and the determined message response time, and marking the status of the pushed message as pushed after completing the message push; a switching unit, for disconnecting the long connection between the current page and the backend in response to a trigger signal for the current page to switch from an active page to a dormant page.
[0019] A third aspect of the present application provides a processor configured to execute the above-mentioned in-station message push method.
[0020] A fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configures the processor to execute the above-mentioned in-station message push method.
[0021] A fifth aspect of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned in-station message push method.
[0022] Through the above technical scheme, the scheme of the present invention establishes a long connection with the back end when the page is in an active state, and sets the message response time according to the design weight of the page, so as to achieve efficient and accurate message push within an appropriate time interval. First, the importance (weight) of the current page is dynamically identified, and the appropriate message response time is determined according to the weight, so that the message push frequency of different pages is optimized. Based on the coordination of long connection and response time, message push can not only be carried out periodically, but also update the message status after each push to ensure that the message is not repeated and uninterrupted. This mechanism significantly reduces the connection resource usage of the server and effectively alleviates the pressure on the server. At the same time, when the page switches to an inactive state, the system disconnects in time to avoid unnecessary resource consumption. This scheme improves the resource utilization and push efficiency of the system, enhances the consistency of user experience and the high availability of the system.
[0023] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:
[0025] Figure 1 The following is a schematic diagram showing a flow chart of the steps of a method for pushing an in-station message according to an embodiment of the present application;
[0026] Figure 2 The system structure diagram of the in-station message push system according to an embodiment of the present application is schematically shown;
[0027] Figure 3 The internal structure diagram of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0029] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0030] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0031] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations. In addition, it should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components, and models may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.
[0032] Figure 1 The flowchart of the method for pushing in-station messages according to an embodiment of the present application is schematically shown. Figure 1 As shown, in one embodiment of the present application, a method for pushing an in-station message is provided, the method comprising:
[0033] Step S10: When it is determined that the current page is an active page, a long connection is established between the current page and the backend.
[0034] Specifically, the rule for determining whether the current page is an active page is as follows: if the user stays on the current page and the stay time on the current page exceeds a preset stay time threshold, the current page is determined to be an active page; conversely, if the user does not stay on the current page, or the stay time on the current page does not exceed the preset stay time threshold, the current page is determined to be a dormant page.
[0035] In an embodiment of the present invention, when a user stays on a page and the stay time exceeds a preset time threshold (e.g., 15 seconds), the page is determined to be an active page, and a long connection with the backend is started to receive real-time message push. If the user does not stay on the page, or the stay time does not reach the preset threshold, the page is determined to be a dormant page, and the long connection will not be started. This design is based on user behavior patterns and effectively avoids unnecessary resource consumption.
[0036] The advantage of this judgment rule is that it manages the page connection status dynamically and intelligently, making resources more efficiently allocated and utilized. The opening of a long connection is only established when the user actively pays attention to the page, thereby reducing the number of invalid connections on the server, reducing the resource occupation pressure caused by long-term connections, and significantly improving the server's load capacity. In particular, when users frequently switch pages or temporarily leave, the long connection of inactive pages can be closed in time, further optimizing the utilization of server resources.
[0037] Furthermore, this rule improves the accuracy and timeliness of message push. When the page is active, updated messages can be pushed in real time to ensure that users can receive important information as soon as possible. When the page enters the dormant state, message push is suspended, which effectively reduces the server bandwidth usage and avoids unnecessary message push. This judgment logic based on the dwell time can adapt to the user's habits in actual use, which not only improves the user experience, but also reduces the operation and maintenance costs.
[0038] Furthermore, the solution of the present invention combines a preset residence time threshold, and adapts to different application scenarios and business needs by flexibly adjusting the threshold size. For pages that are frequently visited, a shorter threshold can be set to ensure the real-time nature of the message, while for low-priority pages, the threshold can be appropriately extended to reduce the use of long connections. This customized page activity determination mechanism not only improves the effectiveness of message push, but also ensures high availability and stability. In summary, by judging the active state of the page, the solution greatly optimizes the allocation of resources, ensures efficient and timely message push, and significantly improves the user experience.
[0039] Furthermore, the rules for establishing a long connection between the current page and the backend are as follows: based on the long connection establishment request sent by the front end to the back end, a long connection between the current page and the back end is established based on the SSE technology, and the long connection status is determined; if the long connection status is a connection failure, the long connection between the current page and the back end is re-established until the long connection status between the current page and the back end is a connection success, or the preset number of retries is reached; if the preset number of retries is reached and the long connection status between the current page and the back end is still a connection failure, the front end closes the long connection establishment request.
[0040] In an embodiment of the present invention, the solution of the present invention is based on the long connection establishment rules of the server-sent event (SSE) technology to ensure that a stable long connection can be successfully established between the front end and the back end. Specifically, when the current page needs to establish a long connection with the back end, the front end first sends an establishment request to the back end, and attempts to create a long connection through the SSE technology. During this process, the connection status is continuously monitored to confirm whether the connection is successful or not. If the long connection fails to be established for the first time, the retry process is automatically entered. If the connection is unsuccessful, a connection request is automatically initiated again until the connection is successful or the set retry limit is reached.
[0041] Furthermore, the solution of the present invention ensures the high availability of long connections while reducing the risk of wasting resources. First, through the automated connection retry mechanism, in the case of network fluctuations or high server load, it can intelligently attempt to establish a connection multiple times, ensuring that users can reestablish the connection after network conditions are restored or the load is reduced, without the need for manual intervention. This greatly improves reliability, especially for real-time message push scenarios, ensuring the timeliness and consistency of messages. Secondly, the maximum number of retries is set to ensure that the front end can automatically stop retrying if the connection cannot be made for a long time, avoiding infinite loops of resource waste and server pressure.
[0042] Based on the solution of the present invention, the long connection establishment rule optimizes resource utilization and avoids network resource occupation caused by frequent connection requests. When the connection fails, the number of retries will be automatically controlled so that resource consumption is always within a reasonable range. Especially when there are a large number of users, server resources can be effectively avoided from being occupied by a large number of connection retries. In addition, by using SSE technology, the solution can achieve efficient long connections while also taking advantage of the one-way communication advantages of SSE, reducing the complexity of connection management and server overhead, meeting the needs of high-concurrency scenarios.
[0043] Step S20: Identify the design weight of the current page, and determine the message response time of the current page based on the design weight.
[0044] Specifically, the identifying of the design weight of the current page includes: matching the design weights of the corresponding message push indicators in a pre-built weight library based on the unique identifier of the current page; wherein the message push indicators include: one or more of the basic weight indicator of the page, the pressure level indicator of the business corresponding to the page, and the message push frequency indicator of the page.
[0045] In the embodiment of the present invention, a unique identifier (URL, path or other specific parameters) is assigned to each page, and the identifier is used to locate the corresponding design weight in the weight library. The weight library stores the weights of various message push indicators, including page basic weight, business pressure level and message push frequency. These indicators can be used independently or in combination to comprehensively reflect the importance of the page and the priority of message push.
[0046] Based on the solution of the present invention, the message push frequency and priority of different pages can be accurately adjusted. For example, pages with high business pressure can obtain higher weights to ensure real-time updates, while pages with low access frequency are assigned lower weights to reduce resource usage. The technical effect of this solution significantly improves the resource utilization efficiency and makes the push strategy more flexible and accurate. At the same time, the user experience on high-weight pages is optimized, and they can receive key information more promptly; while low-weight pages reduce irrelevant pushes, improving overall efficiency and user satisfaction.
[0047] Preferably, determining the message response time of the current page based on the design weight includes: generating the message response time of the current page based on the design weight of each matched message push indicator and the preset basic message response time corresponding to each message push indicator, and the generation rule is:
[0048]
[0049] Where t is the message response time of the current page; t iis the preset basic message response time of the i-th message push indicator; w i is the design weight of the i-th message push indicator; n is the number of message push indicators.
[0050] In an embodiment of the present invention, by assigning different design weights to each message push indicator and combining the corresponding basic message response time, the overall message response time of the current page is obtained. By assigning design weights to each message push indicator, the method can dynamically adapt to the importance and business needs of different pages. For example, for important business pages or pages with high access frequency, a higher weight can be given to shorten the message response time so that users can obtain updated message information in time. On the contrary, for pages with lower priority, a lower weight can be assigned so that resources are concentrated on high priority pages to avoid resource waste. The weighted calculation method effectively improves the flexibility and adaptability of the system by integrating the basic message response time of different indicators. The administrator can adjust the weight value of each indicator according to business needs to meet the message push requirements of different pages. At the same time, as the user behavior data is collected, the weight library can be updated regularly so that the calculation of the message response time is closer to the actual use of the user. This dynamic control mechanism based on design weights and weighted response time can significantly reduce the server load and improve availability and efficiency. In the case of high concurrency, the time interval of message push can be automatically optimized to ensure the real-time push of key messages and avoid unnecessary resource occupation. This intelligent response time control method not only improves the user experience, but also improves the overall performance and stability.
[0051] Preferably, the construction rules of the weight library are as follows: historical message push information is collected, and the historical message push information is classified based on each message push indicator to obtain a historical message push information set corresponding to each message push indicator; an initial weight is determined for each message push indicator, and user usage data is counted based on the corresponding historical message push information set, and each initial weight is updated based on the statistical result as the design weight corresponding to each message push indicator; a weight library is constructed based on the design weight of each message push indicator and the preset basic message response time corresponding to each message push indicator.
[0052] Furthermore, the user usage data includes: any one or more of: page dwell time, message response speed, user click rate and message response frequency; the user usage data is counted based on the corresponding historical message push information sets, and the initial weights are updated based on the statistical results, including: performing data preprocessing on each historical message push information set, and counting the changing trends of the corresponding message push indicators based on the preprocessed historical message push information sets; allocating weights of the corresponding message push indicators based on the changing trends of the corresponding message push indicators, and updating the initial weights based on the allocation results.
[0053] In an embodiment of the present invention, in the process of building a weight library, it is first necessary to collect and organize historical message push data. These historical data not only contain the basic information of each message push, but also involve the user's interaction after receiving these messages, such as page dwell time, message response speed, user click rate and message response frequency. By classifying these historical message push information based on message push indicators, different types of message push information can be divided into corresponding "historical message push information sets", providing a basis for subsequent weight calculation and update.
[0054] Furthermore, an initial weight is determined for each message push indicator. The initial weight is assigned based on the importance of the message, business requirements, and basic settings, and is used to perform basic control of message push in the initial stage of weight library establishment. However, considering the diversity of user behavior and the dynamic changes in demand, these initial weights need to be updated regularly to ensure that the weight library can reflect the actual needs and preferences of users in real time.
[0055] To achieve this, we conduct statistical analysis on user usage data based on the corresponding historical message push information set. For example, by analyzing the page dwell time, we can determine the user's interest in different pages; by counting the message response speed, we can understand the real-time and effectiveness of message push; by analyzing the user click-through rate, we can evaluate the attractiveness of the message content; and the statistics of message response frequency can reveal the frequency of users' demand for specific types of information. All these statistical data can reflect the actual usage of users and are the key basis for weight update.
[0056] During the data analysis process, data preprocessing is performed on each historical message push information set, including data cleaning, deduplication, and outlier detection to ensure data accuracy. The preprocessed data can more realistically reflect user behavior and eliminate invalid data that may interfere with weight calculation. After that, based on the user usage data of each historical message push information set, the change trend of each message push indicator is calculated. For example, if the user click rate and page dwell time of a certain message push indicator increase significantly, it means that the business importance of the indicator may increase, and the weight of the indicator will be increased accordingly.
[0057] Furthermore, based on these changing trends, the weights of various message push indicators are reallocated. Indicators with high demand and high interaction will be given priority during the allocation to ensure that these indicators can get more resource support in future message push. The updated weights not only reflect the needs of current users, but also predict user preferences in the future through trend analysis. Finally, based on these updated weights and the preset basic message response time of each message push indicator, a weight library is constructed and improved. The designed weights in the weight library will be used to control the priority and response frequency of message push, thereby achieving more accurate and efficient message push.
[0058] Based on the scheme of the present invention, this weight library construction rule based on dynamic data update significantly improves the message push effect. By setting different weights for each message push indicator, resources can be intelligently allocated according to the importance of the page and business needs, reducing unnecessary resource waste. Secondly, through real-time analysis of user usage data and dynamic update of weights, the message push strategy can be adjusted in time when user needs change, ensuring that the message content is more in line with the actual needs of users. This weight library construction method also improves flexibility and scalability. Changes in different business scenarios and user behaviors can be automatically reflected in the weight library, reducing the workload and error rate of manual adjustment. Not only can it adapt to the needs of different business priorities and push frequencies, but it can also optimize the message push strategy according to actual data to ensure push efficiency in high concurrency scenarios. This intelligent, data-driven weight library construction method significantly improves the user experience, allowing users to receive key information at the most appropriate time, and enhancing high availability and responsiveness.
[0059] In one possible implementation, the notification system of an e-commerce platform needs to push messages to users to remind them of new promotions, personalized recommendations, or order updates. Based on the weight library construction method of the present invention, the platform can optimize the effect of message push by following the steps below:
[0060] 1) Collect historical message push information: The e-commerce platform first collects historical message push data over a period of time, including the type of message pushed each time (such as promotion reminders, order updates, etc.), the specific time of the push, and the user's interactive behavior after the push (such as page dwell time, click-through rate, etc.).
[0061] 2) Classification and initial weight allocation: These messages will be classified by type and user behavior. For example, promotion reminders generally have a higher click-through rate, indicating that they are more important, so they will be assigned a larger initial weight; although order update messages are important, they have a lower click-through rate than promotion messages, so they will receive a moderate initial weight.
[0062] 3) User behavior analysis based on historical data: Statistical analysis is performed on different types of message push data to obtain user behavior after receiving different messages. For example, users stay on the page of promotional activity messages for a long time and have a high click-through rate, indicating that users are interested in such messages; while the response speed of personalized recommendation messages is low, indicating that users have a weak demand for this type of message, so the system can reduce the push frequency of personalized recommendation messages.
[0063] 4) Data preprocessing and weight update: The platform preprocesses the collected user behavior data, including removing outliers and invalid data. For example, some users click very frequently when receiving promotional messages, which may be abnormal behavior, and these data will be filtered. Subsequently, based on the user feedback trends on different messages, the initial weights of various types of messages are updated. For example, if the click-through rate and dwell time of order update messages increase, it indicates that users’ demand for such messages has increased, and the weight will increase accordingly.
[0064] 5) Build and improve the weight library: Combine the updated weights with the basic message response time of each message to build a new weight library. For example, promotional messages have a higher weight and a shorter basic response time, so they will be pushed to users at the most suitable time to ensure that users can participate in the event in time. Personalized recommendation messages have a lower weight, so the response time can be extended accordingly, reducing the use of system resources.
[0065] 6) Intelligent push optimization: Finally, the platform uses the weight library for intelligent push. When users receive messages, they first receive high-weighted promotion reminders, and then they may receive other messages such as personalized recommendations with lower weights. This optimization method not only improves the user experience and enables users to receive important information faster, but also saves system resources and improves the efficiency of push.
[0066] Step S30: Based on the established long connection and in accordance with the determined message response time, the message push operation is performed at a predetermined period, and after the message push is completed, the status of the pushed message is marked as pushed.
[0067] Specifically, based on the message response time, a new message query is executed in the database every message response time, and the new message with a message status of not pushed is regarded as a new message to be pushed, and the corresponding new message push is executed based on the long connection; after the new message push is completed, the message status of the corresponding new message is modified to pushed in the database.
[0068] In the embodiment of the present invention, the message push process is first triggered regularly according to the message response time. Every other message response time, a new message query operation is performed in the database to obtain all messages with a status of "not pushed". Then, these new messages that have not been pushed are marked as "pending push" and sent to the client through a long connection. This design can ensure the immediacy of messages, especially when the user is online, so that important business notifications can be received in the first place, which improves the real-time performance and user experience.
[0069] After each message is pushed, the status of the corresponding message is immediately updated in the database, changing it from "not pushed" to "pushed". The purpose of this step is to prevent the same message from being pushed repeatedly, avoiding user troubles and resource waste caused by duplicate messages. At the same time, the update of message status also provides basic data for subsequent data statistics and message management, making it possible to track the push status of messages at any time, facilitating statistical analysis and optimizing push strategies.
[0070] Based on the solution of the present invention, by introducing a long connection, it is possible to maintain continuous communication with the client without frequently re-establishing the connection, thereby reducing the resource overhead of the server and the client. Compared with the traditional short connection method, the long connection method not only improves the communication efficiency, but also significantly reduces the resource occupation, which is particularly beneficial to the performance in high concurrency scenarios.
[0071] Secondly, by using the message response time as the push interval, the message push frequency can be flexibly controlled. In different pages or business scenarios, the message response time can be dynamically adjusted to adapt to changes in user needs. For example, for high-priority messages, the message response time can be shortened to increase the push frequency; while for low-priority messages, the response time can be extended to reduce disturbance to users. This flexible push control mechanism effectively improves the adaptability and makes message push more user-friendly and accurate.
[0072] In addition, the update of message status ensures that each message is pushed only once, thus avoiding the waste of resources and the degradation of user experience caused by repeated push. The storage and real-time update of message status also provide a data basis for subsequent analysis. According to these data, statistical analysis of push frequency, response speed, etc. can be performed to optimize the message push strategy, so that the push plan can be dynamically adjusted according to user behavior and needs, and the overall user satisfaction can be improved.
[0073] In one possible implementation, example scenario: message push optimization for a financial trading platform
[0074] 1) Timing trigger system for message push process: The message push process is triggered according to the preset message response time (for example, every 5 seconds), and all messages with the status of "not pushed" in the database are queried. These "not pushed" messages may include market changes, user transaction completion notifications, or account login reminders. After the query is completed, these messages are marked as "pending push".
[0075] 2) Instant push messages through long connections: After the user logs in, the system establishes a long connection to ensure a real-time communication channel with the client. Whenever a scheduled push is triggered, all "pending push" messages will be sent directly to the user's client through a long connection. For example, when the market fluctuates significantly, users can receive transaction reminders in the first place and make trading decisions quickly. This long connection design enables messages to reach users quickly, enhancing the real-time nature and interactive experience of the trading platform.
[0076] 3) Update message status to avoid repeated pushes: After each push, the system will immediately update the status of the corresponding message in the database, changing it from "not pushed" to "pushed" to avoid the same message being sent repeatedly. For example, if the user's status has changed after receiving an account login reminder, the user will not receive the reminder again in the future, preventing unnecessary interruptions caused by multiple pushes.
[0077] 4) Dynamically control message response time: Different message types have different priorities, and the system can dynamically adjust the response time according to actual needs. For example, if an account has an abnormal login, the system will set the response time of such security reminders to 1 second to ensure almost real-time push; and for general market trend analysis push, the response time can be set to 15 seconds to avoid frequent interruptions to users. This flexible push control method ensures the adaptability of message push, allowing the platform to more intelligently adapt to the needs of users in different scenarios.
[0078] 5) Data analysis and strategy optimization based on message status: The system will conduct statistical analysis on the push status, response speed, push frequency and other data of each message to optimize future push strategies. For example, by analyzing the response time of high-priority messages and the user's operation records, the platform can understand the user's behavior pattern after receiving a specific type of message. Based on this analysis result, the system can shorten the push time for similar high-priority messages in the future to ensure that users respond quickly.
[0079] Step S40: In response to a trigger signal for the current page to switch from an active page to a dormant page, disconnect the long connection between the current page and the backend.
[0080] Specifically, when the current page enters the background, it is determined that the current page triggers a trigger signal to switch from the active page to the dormant page; in response to the trigger signal that the current page switches from the active page to the dormant page, the front end stops sending a long connection establishment request to the back end, and the long connection between the current page and the back end is disconnected.
[0081] Based on the solution of the present invention, when a page changes from an active state to a dormant state, a trigger signal is generated, indicating that the page has entered an inactive state. After detecting the trigger signal, the front end immediately stops sending a long connection establishment request to the back end, and actively disconnects the established long connection, thereby releasing the resource occupation of the server and the client. Traditional long connections may still remain connected after the page is switched to the background, occupying server and network resources, resulting in increased load, especially in a high-concurrency environment, which may cause unnecessary resource consumption and even server performance degradation. By disconnecting the long connection when the page is dormant, it is possible to effectively reduce the waste of resources, reduce the pressure on the server, ensure that resources can be allocated to active users first, and improve the response speed and stability.
[0082] Furthermore, for pages that are no longer viewed, messages are no longer pushed or connections are maintained, which avoids power and bandwidth consumption on the user's device. This design is particularly important on mobile devices, which can reduce the impact on battery life and reduce traffic consumption caused by background processes.
[0083] Based on the solution of the present invention, dynamic allocation and efficient utilization of resources are achieved through intelligent long connection management. It ensures that server resources always give priority to serving active pages, improving overall performance. At the same time, when the page returns to the foreground, the long connection can be quickly re-established to ensure the continuity and real-time nature of message push.
[0084] Figure 1 FIG. 1 is a flow chart of a method for pushing in-station messages in an embodiment. It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0085] In one embodiment, Figure 2As shown, a system for pushing in-site messages is provided, the system comprising: a connection unit, for establishing a long connection between the current page and the backend when the current page is determined to be an active page; a processing unit, for identifying the design weight of the current page, and determining the message response time of the current page based on the design weight; a message pushing unit, for periodically pushing messages based on the established long connection and the message response time, and updating the message status after each message push; a switching unit, for disconnecting the long connection between the current page and the backend in response to a trigger signal for the current page to switch from an active page to a dormant page.
[0086] A third aspect of the present application provides a processor configured to execute the above-mentioned in-station message push method.
[0087] A fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, configures the processor to execute the above-mentioned in-station message push method.
[0088] A fifth aspect of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned in-station message push method.
[0089] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05 and a memory (not shown in the figure) connected through a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A06. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor A01, a method for pushing in-station messages is implemented. The display screen A04 of the computer device can be a liquid crystal display or an electronic ink display, and the input device A05 of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse.
[0090] Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0091] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0092] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0093] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0094] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0095] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0096] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0097] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0098] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0099] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for pushing in-station messages, characterized in that: The method comprises: When the current page is determined to be the active page, a long connection is established between the current page and the backend; Identify the design weight of the current page, and determine the message response time of the current page based on the design weight; wherein, The design weight of the current page is determined based on the coupling of various message push indicators of the current page; Based on the established persistent connection, according to the determined message response time, the message push operation is performed at a predetermined period, and after the message push is completed, the status of the pushed message is marked as pushed; In response to a trigger signal that the current page switches from an active page to a dormant page, the long connection between the current page and the backend is disconnected.
2. The method according to claim 1, characterized in that The determination rule of whether the current page is an active page is as follows: If the user stays on the current page and the stay time on the current page exceeds the preset stay time threshold, the current page is determined to be the active page; On the contrary, if the user does not stay on the current page, or the time spent on the current page does not exceed a preset stay time threshold, the current page is determined to be a dormant page.
3. The method according to claim 1, characterized in that The rules for establishing a long connection between the current page and the backend are: Based on the persistent connection establishment request sent by the front-end to the back-end, a persistent connection is established between the current page and the back-end based on the SSE technology, and the persistent connection status is determined; If the persistent connection status is connection failure, re-establish the persistent connection between the current page and the backend until the persistent connection status between the current page and the backend is connection success, or the preset number of retries is reached; If the preset number of retries is reached and the persistent connection status between the current page and the backend is still connection failure, the frontend closes the persistent connection establishment request.
4. The method according to claim 1, characterized in that: The identifying the design weight of the current page includes: Based on the unique identifier of the current page, the design weights of the corresponding message push indicators are matched in the pre-built weight library; The message push indicators include: One or more of the following: the basic weight index of the page, the pressure index of the business corresponding to the page, and the frequency index of message push of the page.
5. The method according to claim 4, characterized in that The determining the message response time of the current page based on the design weight includes: Based on the design weights of the matched message push indicators and the preset basic message response time corresponding to each message push indicator, the message response time of the current page is generated. The generation rules are: Among them, t is the message response time of the current page; t i is the preset basic message response time of the i-th message push indicator; w i is the design weight of the i-th message push indicator; n is the number of message push indicators.
6. The method according to claim 4, characterized in that The construction rules of the weight library are: Collect historical message push information, and classify the historical message push information based on each message push indicator to obtain a historical message push information set corresponding to each message push indicator; Determine an initial weight for each message push indicator, and collect user usage data based on the corresponding historical message push information sets, and update each initial weight based on the statistical results as the design weight for each message push indicator; A weight library is constructed based on the design weights of each message push indicator and the preset basic message response time corresponding to each message push indicator.
7. The method according to claim 6, characterized in that The user usage data includes: Any one or more of page dwell time, message response speed, user click rate, and message response frequency; The method of counting user usage data based on the corresponding historical message push information sets and updating each initial weight based on the statistical result includes: Perform data preprocessing on each historical message push information set, and calculate the change trend of each corresponding message push indicator based on each preprocessed historical message push information set; Based on the changing trends of each message push indicator, the corresponding weights of each message push indicator are allocated, and the initial weights are updated based on the allocation results.
8. The method according to claim 1, characterized in that The method of performing a message push operation at a predetermined period based on the established long connection and determining the status of the pushed message as pushed after completing the message push includes: Based on the message response time, a new message query is performed in the database every time a message response time passes, a new message whose message status is not pushed is regarded as a new message to be pushed, and a corresponding new message is pushed based on the long connection; After the new message is pushed, the message status of the corresponding new message in the database is changed to pushed.
9. The method according to claim 1, characterized in that: In response to a trigger signal that the current page switches from the active page to the dormant page, disconnecting the long connection between the current page and the backend includes: When the current page enters the background, it is determined that the current page triggers a trigger signal to switch from the active page to the dormant page; In response to a trigger signal that the current page switches from an active page to a dormant page, the front end stops sending a persistent connection establishment request to the back end, and the persistent connection between the current page and the back end is disconnected.
10. A system for pushing messages within a website, characterized in that: The system comprises: A connection unit, used to establish a long connection between the current page and the backend when the current page is determined to be an active page; A processing unit is used to identify the design weight of the current page and determine the message response time of the current page based on the design weight; wherein, The design weight of the current page is determined based on the coupling of various message push indicators of the current page; The message push unit is used to push messages according to the established persistent connection and the determined message response time at a predetermined period, and to mark the status of the pushed message as pushed after the message push is completed; The switching unit is used to disconnect the long connection between the current page and the back end in response to a trigger signal for switching the current page from the active page to the dormant page.
11. A processor, characterized in that: The method is configured to execute the in-station message pushing method according to any one of claims 1 to 9.
12. A machine-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by a processor, the processor is configured to execute the in-station message pushing method according to any one of claims 1 to 9.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the method for pushing in-station messages according to any one of claims 1 to 9.