Methods, devices, systems, and equipment for filtering and linking incremental message notifications based on WebSocket
By caching filter conditions and receiving incremental snapshot notification signals in the web frontend, and sending incremental query requests based on timestamps, the bandwidth and load issues caused by indiscriminate WebSocket push are resolved, achieving more efficient message notifications and resource utilization.
Patent Information
- Application Number
- CN202611233383.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, the backend server pushes all data to the web frontend indiscriminately every time there is new data, which leads to increased bandwidth consumption and server load, affecting message real-time performance and system resource utilization efficiency.
By caching user filter criteria and receiving incremental snapshot notification signals in the web frontend, incremental query requests are sent based on the target filter criteria and the current list timestamp to obtain the number of newly added data that meet the criteria, and reminder information is output or complete data is obtained only when necessary.
It effectively reduces the bandwidth consumption of WebSocket connections and the push load on the backend server, avoids interference from invalid reminders, and improves the accuracy of message reminders and the efficiency of system resource utilization.
Smart Images

Figure CN123123099A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of real-time communication and data interaction technology for web front-ends, and in particular to a method, apparatus, system and device for filtering and linking incremental message reminders based on WebSocket. Background Technology
[0002] With the rapid development of internet and mobile internet technologies, web applications have become deeply integrated into various business scenarios, and users' demands for real-time page data are increasing. Typical web pages such as message lists, task dashboards, operations and maintenance monitoring, and data reports often employ a page layout with a list display area and a top filter area, allowing users to filter and view data according to their needs. Simultaneously, to achieve real-time triggering of data updates, the WebSocket protocol is commonly used to establish a communication connection between the front-end and back-end servers. The back-end server proactively pushes messages to the front-end when data is updated in the database, informing users of the new data.
[0003] In existing technologies, when a backend server detects that new data has been written to the database, it typically uses the WebSocket protocol to establish a communication connection and push all the new data to the web frontend. The web frontend then directly renders and updates the list, or pops up a reminder to notify the user to refresh the list.
[0004] However, because the backend server performs indiscriminate pushes every time there is new data, the bandwidth of the WebSocket connection is heavily consumed, and the server push load increases significantly. Summary of the Invention
[0005] Therefore, it is necessary to provide a method, apparatus, system, and device for filtering and linking incremental message notifications based on WebSocket to address the aforementioned technical problems.
[0006] Firstly, this application provides a WebSocket-based method for filtering and linking incremental message notifications, applied to a web front-end, including:
[0007] Establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0008] Monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations;
[0009] It receives notification signals transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0010] In response to the notification signal, based on the target filtering criteria and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of newly added data that meet the target filtering criteria, and the query results determine whether to output a reminder message.
[0011] In one embodiment, the user-triggered filtering operation is monitored, and the target filtering conditions corresponding to the filtering operation are cached, including:
[0012] Monitor filtering operations triggered by users in the filter criteria area of a web page, and record the last operation time of the filtering operation; the filtering operation includes at least one of the user's actions of checking, toggling, and canceling the filter criteria;
[0013] Update the last operation time if a change in the screening criteria is detected.
[0014] If the time interval between the current moment and the last operation time reaches the preset dwell time, it is determined that the user has completed the filtering operation, and all current filtering conditions are written to the local cache as target filtering conditions.
[0015] In one embodiment, the above-described WebSocket-based filtering and incremental message notification method further includes:
[0016] In response to the user's refresh operation based on the reminder information, the system requests the complete new data that meets the target filter criteria from the backend server.
[0017] Receive and display complete new data that matches the target filtering criteria returned by the backend server.
[0018] In one embodiment, determining whether to output a reminder message based on the query results includes:
[0019] If the query results show that the number of newly added data to the target is greater than zero, output a notification message;
[0020] If the query result shows that the number of newly added data to the target is zero, the notification signal transmitted will be processed silently.
[0021] Secondly, this application provides a WebSocket-based method for filtering and linking incremental message notifications, applied to a backend server, including:
[0022] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0023] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0024] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0025] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0026] In one embodiment, the above-described WebSocket-based filtering and incremental message notification method further includes:
[0027] Responding to a complete data retrieval request sent by the web frontend upon triggering a notification message; wherein the complete data retrieval request carries the target filtering conditions;
[0028] Query the complete newly added data that meets the target filter criteria, and return the complete newly added data to the web frontend so that the web frontend can display the complete newly added data.
[0029] Thirdly, this application also provides a WebSocket-based filtering and incremental message notification device, applied to a web front-end, including:
[0030] The first connection module is used to establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0031] The first monitoring module is used to monitor the filtering operations triggered by users and cache the target filtering conditions corresponding to the filtering operations.
[0032] The first receiving module is used to receive notification signals transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0033] The first output module is used to respond to notification signals by sending an incremental query request to the backend server based on the target filtering conditions and the timestamp of the first data in the current list, in order to obtain the number of newly added data that meet the target filtering conditions, and to determine whether to output a reminder message based on the query results.
[0034] Fourthly, this application also provides a WebSocket-based filtering and linkage incremental message notification device, applied to a backend server, including:
[0035] The second connection module is used to establish a real-time communication connection with the web front-end based on the WebSocket protocol;
[0036] The second monitoring module is used to send a notification signal to the Web frontend through a real-time communication connection when new data is detected in the pre-built database, so as to trigger the Web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0037] The second receiving module is used to receive incremental query requests sent by the Web frontend and query the number of new data to be added based on the incremental query requests.
[0038] The second output module is used to return the query results to the web front end, so that the web front end can determine whether to output a reminder message based on the query results.
[0039] Fifthly, this application also provides a WebSocket-based filtering and linkage incremental message notification system, including a web front-end and a back-end server;
[0040] The web front-end is used to execute the WebSocket-based filtering and incremental message notification method, as described in the first aspect.
[0041] The backend server is used to execute the WebSocket-based filtering and incremental message notification method, as described in the second aspect.
[0042] Sixthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0043] Establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0044] Monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations;
[0045] It receives notification signals transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0046] In response to the notification signal, based on the target filtering criteria and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of newly added data that meet the target filtering criteria, and the query results determine whether to output a reminder message.
[0047] In a seventh aspect, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0048] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0049] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0050] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0051] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0052] Eighthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0053] Establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0054] Monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations;
[0055] It receives notification signals transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0056] In response to the notification signal, based on the target filtering criteria and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of newly added data that meet the target filtering criteria, and the query results determine whether to output a reminder message.
[0057] Ninthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0058] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0059] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0060] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0061] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0062] In a tenth aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0063] Establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0064] Monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations;
[0065] It receives notification signals transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0066] In response to the notification signal, based on the target filtering criteria and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of newly added data that meet the target filtering criteria, and the query results determine whether to output a reminder message.
[0067] In an eleventh aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0068] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0069] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0070] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0071] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0072] The aforementioned WebSocket-based incremental message notification method, apparatus, system, and device establish a real-time communication connection with a backend server via the WebSocket protocol; monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations; receive notification signals transmitted by the backend server through the real-time communication connection when new data is detected; the notification signals are incremental snapshot notification signals and do not contain specific data content; in response to the notification signals, based on the target filtering conditions and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of new data that meet the target filtering conditions, and the output of a notification message is determined based on the query results. This method not only effectively reduces the bandwidth consumption of the WebSocket connection and the push load on the backend server, but also avoids interference to users caused by invalid notifications, thereby significantly improving the accuracy of list page message notifications and the efficiency of system resource utilization while ensuring message real-time performance. Attached Figure Description
[0073] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0074] Figure 1 This is an application environment diagram of a WebSocket-based filtering and linkage incremental message notification method in one embodiment;
[0075] Figure 2 This is one of the flowcharts illustrating a WebSocket-based filtering and incremental message notification method in one embodiment.
[0076] Figure 3 This is the second flowchart of a WebSocket-based filtering and linkage incremental message notification method in one embodiment;
[0077] Figure 4 This is the third flowchart of a WebSocket-based filtering and linkage incremental message notification method in one embodiment;
[0078] Figure 5 This is the fourth flowchart of a WebSocket-based filtering and linkage incremental message notification method in one embodiment;
[0079] Figure 6 This is the fifth flowchart of a WebSocket-based filtering and linkage incremental message notification method in one embodiment;
[0080] Figure 7 This is one of the structural block diagrams of a WebSocket-based filtering and linkage incremental message notification device in one embodiment;
[0081] Figure 8 This is the second structural block diagram of a WebSocket-based filtering and linkage incremental message reminder device in one embodiment;
[0082] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0083] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0084] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0085] With the rapid development of internet and mobile internet technologies, web applications have become deeply integrated into various business scenarios, and users' demands for real-time page data are increasing. Typical web pages such as message lists, task dashboards, operations and maintenance monitoring, and data reports often employ a page layout with a list display area and a top filter area, allowing users to filter and view data according to their needs. Simultaneously, to achieve real-time triggering of data updates, the WebSocket protocol is commonly used to establish a communication connection between the front-end and back-end servers. The back-end server proactively pushes messages to the front-end when data is updated in the database, informing users of the new data.
[0086] In existing technologies, when a backend server detects that new data has been written to the database, it typically uses the WebSocket protocol to establish a communication connection and push all the new data to the web frontend. The web frontend then directly renders and updates the list, or pops up a reminder to notify the user to refresh the list.
[0087] However, because the backend server performs indiscriminate pushes every time there is new data, the bandwidth of the WebSocket connection is heavily consumed, and the server push load increases significantly.
[0088] In view of the above-mentioned technical problems, this application provides a method for filtering and linking incremental message reminders based on WebSocket. The following embodiments will specifically describe this method for filtering and linking incremental message reminders based on WebSocket.
[0089] The WebSocket-based filtering and incremental message notification method provided in this application can be applied to, for example... Figure 1The illustrated WebSocket-based incremental message notification system 1 for filtering is described. This system includes a web frontend 10 and a backend server 20. The web frontend 10 includes a WebSocket connection module 11, a filtering operation monitoring module 12, a data verification module 13, and a list display and refresh module 14. The backend server 20 includes a WebSocket service module 21, a database monitoring module 22, a data query module 23, and a push module 24. Specifically, the WebSocket connection module 11 establishes a real-time communication connection with the backend server 20 based on the WebSocket protocol. This connection is maintained after establishment, allowing the backend server 20 to actively push notification signals to the frontend. The filtering operation monitoring module 12 listens for filtering operations triggered by the user in the filtering condition area. When the user completes the filtering operation and remains in the area for a preset time, this module saves the current filtering condition as the target filtering condition to the local cache. The data verification module 13 is activated upon receiving a notification signal from the backend server 20. It reads the target filtering conditions from the local cache and obtains the timestamp of the first data item in the current list. Using both as query parameters, it initiates an incremental query to the backend to obtain the number of newly added data items that meet the target filtering conditions. Based on this number, it decides whether to output a notification message. The list display and refresh module 14 is responsible for the initial rendering of the list data. After the user clicks the refresh operation in the notification message, it requests the complete set of newly added data from the backend, carrying the target filtering conditions, and displays it in the list area. In the backend server 20, the WebSocket service module 21 listens for and responds to connection requests from the web frontend 10, establishing a real-time communication connection based on the WebSocket protocol. The database monitoring module 22 monitors write events to the database tables in real time using database triggers or periodic polling. After the database monitoring module 22 detects newly added data, the push module 24 sends a notification signal to the web frontend 10 via the WebSocket service module 21. This notification signal is an incremental snapshot notification signal, carrying only the status information of data updates and not containing any specific content of the newly added data. The data query module 23 receives the incremental query request sent by the Web front-end 10, parses out the target filtering conditions and timestamps carried in it, counts the number of new data that meet the filtering conditions and whose creation time is later than the timestamp in the database, and returns the statistical results to the Web front-end 10 to assist in making a decision on whether to output a reminder message.
[0090] Those skilled in the art will understand that Figure 1The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0091] In one exemplary embodiment, such as Figure 2 As shown, a method for filtering and linking incremental message notifications based on WebSocket is provided, which is then applied to... Figure 1 This will be explained using the web front-end as an example, including:
[0092] S201 establishes a real-time communication connection with the backend server based on the WebSocket protocol.
[0093] The backend server is the server side that provides data services, and it deploys a WebSocket server program.
[0094] In this embodiment, after a user enters the target web page, the web frontend initiates a WebSocket handshake request to the backend server by calling the WebSocket application programming interface (API) provided by the browser, establishing a full-duplex and low-latency real-time communication connection with the backend server. This real-time communication connection is maintained after establishment to receive notification signals actively pushed by the backend server, ensuring that the backend server can transmit notification signals to the frontend in real time when it detects new data being written to the database. Simultaneously, during the establishment and maintenance of the real-time communication connection, the web frontend also needs to ensure the connection's stability (e.g., maintaining long-term connection activity by periodically sending heartbeat frames), reliability (e.g., automatically triggering a reconnection mechanism when the connection is abnormally disconnected), and security (e.g., implementing encryption measures) to guarantee the real-time delivery of subsequent push messages and the security of data transmission.
[0095] S202, monitor the filtering operation triggered by the user and cache the target filtering conditions corresponding to the filtering operation.
[0096] In this embodiment, the web front-end monitors the filtering operations triggered by the user on the list page in real time. When the user selects, toggles, or cancels the filtering components (such as checkboxes, dropdowns, or date pickers) in the filtering criteria area, the computer device collects the status values of all current filtering criteria and writes them as target filtering criteria to the local cache for subsequent incremental query processes.
[0097] S203 receives a notification signal transmitted by the backend server through a real-time communication connection when new data is detected.
[0098] The notification signal is an incremental snapshot notification signal, which does not contain specific data content. It is only used as a trigger signal to inform the web frontend that there is currently a data update, so as to trigger the web frontend to retrieve the new data that meets the current filtering conditions.
[0099] In this embodiment, the web frontend receives a notification signal from the backend server via a real-time communication connection when new data is being written to the database. Throughout the transmission process, the backend server only transmits this incremental snapshot notification signal and does not transmit any newly added data entities or data details, thereby reducing bandwidth consumption caused by the WebSocket connection and the transmission load on the backend server. Simultaneously, upon receiving the incremental snapshot notification signal, the web frontend does not directly render or display any data but triggers a subsequent incremental query operation, actively initiating a query to obtain the amount of new data that meets the current filtering criteria.
[0100] S204, in response to the notification signal, sends an incremental query request to the backend server based on the target filtering conditions and the timestamp of the first data in the current list to obtain the number of newly added data that meet the target filtering conditions, and determines whether to output a reminder message based on the query results.
[0101] The timestamp represents the creation or update time of the first piece of data in the current list display area, and is used to define the query scope for newly added data.
[0102] In this embodiment, the web frontend responds to a notification signal from the backend server and triggers an incremental query process. Specifically, the web frontend first reads the target filter condition corresponding to the filter operation triggered by the user in the filter condition area from the local cache, and obtains the timestamp of the first data in the current list display area. Subsequently, the web frontend sends an incremental query request to the backend server using the target filter condition and the timestamp as query parameters to obtain the number of newly added data that meet the target filter condition and whose data creation time is later than the timestamp. It should be noted that this incremental query request only requests the number of newly added data, not the complete list of newly added data.
[0103] After receiving the query results from the backend server, the web frontend determines whether to output a notification message based on the results. If the query results show that the number of newly added data is greater than zero, it indicates that there is new data that matches the user's current filtering criteria, and the web frontend outputs a notification message. If the query results show that the number of newly added data is zero, it indicates that although new data has been added to the database, it does not meet the user's current filtering range. In this case, the web frontend silently processes the locally transmitted notification signal, that is, it does not output any notification message on the frontend page, thereby avoiding unnecessary disturbance to the user.
[0104] The aforementioned WebSocket-based incremental message notification method for filtering links establishes a real-time communication connection with the backend server; monitors user-triggered filtering operations and caches the corresponding target filtering conditions; receives notification signals transmitted by the backend server through the real-time communication connection when new data is detected; these notification signals are incremental snapshot notification signals and do not contain specific data content; in response to the notification signals, an incremental query request is sent to the backend server based on the target filtering conditions and the timestamp of the first item in the current list to obtain the number of new data items that meet the target filtering conditions, and determines whether to output a notification message based on the query results. This method not only effectively reduces the bandwidth consumption of the WebSocket connection and the push load on the backend server, but also avoids interference to users caused by invalid notifications, thus significantly improving the accuracy of list page message notifications and the efficiency of system resource utilization while ensuring message real-time performance.
[0105] In an exemplary embodiment, the "monitoring user-triggered filtering operation and caching the target filtering conditions corresponding to the filtering operation" in S202 above, such as Figure 3 As shown, it includes:
[0106] S301, monitor the filtering operations triggered by the user in the filter criteria area of the web page, and record the last operation time of the filtering operation.
[0107] The filtering operation includes at least one of the following: the user's selection, switching, and cancellation of filtering conditions.
[0108] In this embodiment, the web front-end monitors in real time the filtering operations triggered by the user in the filtering criteria area of the web page. For example, this filtering criteria area may be located at the top of the web page and includes one or more filtering criteria components. These components may include one or more of checkboxes, dropdown lists, radio buttons, and date range selectors. The user interacts with each filtering criteria component in the filtering criteria area to set corresponding selection criteria. Simultaneously, during the monitoring process, the web front-end records the last operation time for each filtering operation in real time and uses this time to determine whether the user has completed the filtering operation.
[0109] S302, update the last operation time when a change in the screening criteria is detected.
[0110] In this embodiment, after detecting a user's triggering of a filtering operation, the web frontend further determines whether the detected filtering operation has caused a change in the filtering conditions. If the user's current selection, switching, or cancellation operation causes a change in the current filtering conditions compared to before the change (for example, the user selects an option that has never been selected, changes a filtering dimension from state A to state B, or cancels the selection of an option), the web frontend determines that the filtering conditions have changed and updates the recorded last operation time to the time when the filtering operation occurred. If the user's current operation does not cause a substantial change in the filtering conditions (e.g., the user clicks on an option that has already been selected), the web frontend does not update the last operation time, thereby filtering out invalid operations.
[0111] S303: If the time interval between the current moment and the last operation time reaches the preset dwell time, determine that the user has completed the filtering operation, and write all current filtering conditions as target filtering conditions into the local cache.
[0112] In this embodiment, after each update of the last operation time, the web frontend calculates the time interval between the current moment and the last operation time in real time, and determines whether the time interval has reached a preset dwell time. This preset dwell time can be used to determine whether the user has completed the filtering operation based on the filter conditions, i.e., the user has stopped adjusting the filter conditions and entered the browsing state from the filtering state. At this time, the web frontend uses the current state values of all filter conditions in the current filter condition area as the target filter conditions and writes them into the local cache for subsequent incremental queries. If the time interval has not reached the preset dwell time, the web frontend continues to wait and continuously monitor the user's subsequent filtering operations.
[0113] In an exemplary embodiment, the above-described WebSocket-based filtering and incremental message notification method, such as... Figure 4 As shown, it also includes:
[0114] S401, in response to the user's refresh operation based on the reminder information, requests the complete new data that meets the target filter conditions from the backend server.
[0115] In this embodiment, after outputting a reminder message, the web frontend immediately monitors the user's response to the reminder message. For example, the reminder message may include a refresh operation entry (such as a refresh button or a view button). After seeing the reminder message, if the user wants to view the specific content of newly added data that meets the filter criteria, they can click the refresh operation entry to refresh the page. In response to this refresh operation, the web frontend reads the target filter criteria from its local cache and sends a complete data retrieval request to the backend server, carrying these criteria. This complete data retrieval request requests the complete newly added data that meets the target filter criteria; that is, it requests a list of data containing all field information, not just the number of newly added data items. It should be noted that if the user does not click the refresh operation entry, the web frontend will not trigger the complete new data retrieval process, and the list will maintain its original data display state, thereby avoiding interference with the user's current browsing due to automatic refresh and reducing unnecessary data transmission.
[0116] S402 receives and displays the complete new data that matches the target filtering criteria returned by the backend server.
[0117] In this embodiment, the web frontend receives complete new data returned by the backend server in response to a complete data retrieval request. This complete new data consists of complete information about one or more new data entries that meet the target filtering criteria and whose creation time is later than the timestamp of the first data entry in the current list. Subsequently, after receiving the complete new data, the web frontend updates the list display area of the web page, rendering and displaying the complete new data in the list display area. For example, the web frontend can insert the complete new data at the top of the list, append it to the end of the list, or display it according to the original sorting rules of the list. It should be noted that in the updated list, the original first data entry, which served as the timestamp reference, may be replaced by the new data; subsequent incremental queries will use the timestamp of the first data entry in the updated list as the new reference.
[0118] In one exemplary embodiment, based on the WebSocket-based filtering and linked incremental message notification method described in any of the foregoing embodiments, another WebSocket-based filtering and linked incremental message notification method is also provided, applied to a backend server, such as... Figure 5 As shown, it includes:
[0119] S101 establishes a real-time communication connection with the web frontend based on the WebSocket protocol.
[0120] In this embodiment, when a user accesses a target web page through a web frontend, the web frontend initiates a WebSocket handshake request. The backend server responds to this WebSocket handshake request and establishes a full-duplex, low-latency real-time communication connection with the web frontend. This real-time communication connection is maintained after establishment, allowing the backend server to proactively send notification signals to the web frontend when it detects new data being written to the database, ensuring real-time message delivery. Simultaneously, during the establishment and maintenance of the real-time communication connection, the backend server also needs to ensure the connection's stability (e.g., responding to heartbeat frames sent by the web frontend to maintain long-term connection activity), reliability (e.g., supporting reconnection negotiation in case of abnormal connection loss), and security (e.g., performing encrypted transmission) to guarantee the real-time delivery of subsequent push messages and the security of data transmission.
[0121] S102, upon detecting new data in the pre-built database, a notification signal is sent to the Web frontend via a real-time communication connection to trigger the Web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0122] In this embodiment, the backend server monitors for new data write events in the database through pre-set database triggers or periodic queries. When new data is detected in the database, the backend server sends a notification signal to the web frontend via an established WebSocket real-time communication connection. This notification signal is an incremental snapshot notification signal, which does not contain specific data content and serves only as a trigger signal to inform the web frontend that there is a data update in the database. Subsequently, upon receiving the notification signal, the web frontend triggers an incremental query process in response, that is, it sends an incremental query request to the backend server based on the target filtering conditions cached locally and the timestamp of the first data in the current list. It should be noted that throughout the entire push process, the backend server only transmits the notification signal and does not transmit any new data entities or data details, thereby reducing the bandwidth consumption of the WebSocket connection.
[0123] S103 receives the incremental query request sent by the Web frontend and queries the number of newly added data based on the incremental query request.
[0124] In this embodiment, the backend server receives an incremental query request sent by the web frontend in response to a notification signal. This incremental query request carries target filtering conditions and a timestamp. The target filtering conditions are the status values of all current filtering conditions cached locally by the web frontend after detecting that a user has completed a filtering operation and remained on the page for a preset time (e.g., 1 to 3 seconds). The timestamp is the creation or update time of the first piece of data in the current list display area of the web frontend. Upon receiving the incremental query request, the backend server parses it and extracts the target filtering conditions and the timestamp. Subsequently, the backend server uses the target filtering conditions as data filtering criteria and the timestamp as a data addition time threshold to perform a query operation in the database, counting the number of newly added data items that simultaneously meet the target filtering conditions and whose creation time is later than the timestamp. By performing the above query operation, the backend server obtains the number of target newly added data items that meet the above conditions.
[0125] S104. Return the query results to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0126] In this embodiment, the backend server uses the number of newly added target data as the query result and returns it to the web frontend via a preset communication protocol. For example, the query result indicates the total amount of incrementally added data that meets the target filtering criteria. Upon receiving the query result, the web frontend determines whether to output a notification message. If the query result indicates that the number of newly added target data is greater than zero, the web frontend outputs a notification message; if the query result indicates that the number of newly added target data is equal to zero, the web frontend silently processes the notification signal and does not output any notification message. After returning the query result, the backend server maintains a real-time WebSocket communication connection with the web frontend and continuously monitors the newly added data in the database, awaiting the next round of data updates.
[0127] In an exemplary embodiment, the above-described WebSocket-based filtering and incremental message notification method, such as... Figure 6 As shown, it also includes:
[0128] S201, responding to a complete data retrieval request sent by the web frontend upon triggering a notification message.
[0129] The complete data retrieval request includes target filtering conditions.
[0130] In this embodiment, after returning the query results to the web frontend, the backend server maintains a real-time communication connection with the web frontend and monitors requests from the web frontend. When a user refreshes the notification information output by the web frontend, the web frontend responds by generating a complete data retrieval request and sends it to the backend server. This complete data retrieval request carries target filtering conditions to request complete new data that meets the target filtering conditions. The backend server receives and parses the complete data retrieval request, extracting the target filtering conditions carried within it.
[0131] S202: Query the complete new data that meets the target filter conditions, and return the complete new data to the web front-end so that the web front-end can display the complete new data.
[0132] In this embodiment, the backend server performs a query operation in the database based on the extracted target filtering conditions. It is worth noting that this query operation uses the target filtering conditions as data filtering criteria, selecting all newly added data from the database that meets the target filtering conditions and whose creation time is later than the timestamp of the first data entry in the current list, and obtaining the complete data records of all newly added data. Subsequently, after retrieving the complete newly added data, the backend server returns the retrieved complete newly added data to the web frontend. Upon receiving the complete newly added data, the web frontend updates the list display area, rendering and displaying the complete newly added data in the list.
[0133] The above embodiments are explained and illustrated by some examples below, which do not limit the technical solution.
[0134] Example 1 uses a message management list page of a company as an application scenario. The top of this message management list page has a filter area with checkboxes for message types (e.g., notifications, announcements, and reminders) and dropdown menus for status (e.g., read or unread). The main body of the page is the message list display area, where each message includes fields such as message content, message type, status identifier, and creation time. The web frontend is developed using the Vue.js framework, supports the WebSocket protocol, and has functions for monitoring filter conditions, data caching, and displaying reminder pop-ups. The backend server is developed using Java / Python, deploying a WebSocket server program (such as Spring WebSocket or Node.js WebSocket), and pre-built with a message database (such as MySQL or PostgreSQL). This database contains message tables used to store all message data. Real-time data interaction between the web frontend and the backend server is based on the WebSocket protocol, ensuring stable and low-latency real-time communication. The following describes the specific implementation process of this technical solution in detail based on this environment.
[0135] The first step involves the user opening the target web page (such as the "Message Management List Page") through a browser. After the page loads, the computer device establishes a real-time communication connection with the backend server based on the WebSocket protocol by executing `new WebSocket("ws: / / xxx.xxx.xxx:8080 / ws / notify")`. Once the connection is successfully established, the computer device sends a "connection successful" confirmation signal to the backend server. Upon receiving this confirmation signal, the backend server confirms that the real-time communication channel with the current web frontend is ready and begins listening for subsequent requests and push tasks.
[0136] The second step involves the user filtering in the filter criteria area, for example, selecting "Notification" as the type and "Unread" as the status. The computer device listens for the `change` event of the filter criteria component (such as a checkbox or dropdown) using `addEventListener`, recording the time of each user action. If the user stops operating for more than 2 seconds (this dwell time is configurable, for example, set to 1 to 3 seconds depending on the actual scenario), it is determined that the user has completed the filtering operation and entered browsing mode. At this time, the computer device writes the currently selected filter criteria (such as `{"type":"Notification","status":"Unread"}`) as the target filter criteria to the local cache (such as `localStorage` or memory). If the user continues to perform filtering operations within the dwell time, the computer device updates the last operation time and restarts the timer until the time interval between the user's stop operations reaches the dwell time, and then performs the cache operation. The above 2-second dwell time is the default value and can be adjusted according to the business scenario in actual deployment to avoid triggering invalid incremental queries when users frequently switch filter criteria.
[0137] Third, the backend server monitors the "Message Table" in the MySQL database for new data additions via database triggers or periodic polling (the polling interval is 1 second by default and can be dynamically adjusted according to the frequency of data additions). When new data insertion is detected, the backend server generates a notification signal. This notification signal is an incremental snapshot notification signal and does not contain specific data content. For example, the notification signal can be JSON data in the format {"type":"newData","status":"ready"}. The backend server pushes this notification signal to the web frontend through the previously established WebSocket real-time communication connection.
[0138] Fourth, after receiving the notification signal pushed by the backend server, the web frontend triggers an incremental query process in response. The computer device reads the target filter criteria (such as {"type":"notification","status":"unread"}) from the local cache, and simultaneously obtains the creation timestamp of the first piece of data in the current message list display area (such as 16800000000000). Then, the computer device uses the filter criteria and timestamp as query parameters to initiate a GET request through the axios library. An example request address is shown below. http: / / xxx.xxx.xxx:8080 / api / queryNewData?filter=xxx×tamp= 1680000000000The request asks the backend server to query the total number of newly added data entries that meet certain criteria. Upon receiving the request, the backend server executes a MySQL database query based on the filter criteria and timestamps. An example SQL statement would be: `SELECT COUNT(*) AS total FROM message WHERE type='Notification' AND status='Unread' AND createTime>1680000000000`, which returns the total number of newly added data entries that meet the criteria. Assuming there are currently 5 newly added messages that meet the above criteria, the query result would be `total=5`. The backend server then returns the query result (e.g., `{"total":5}`) to the web frontend.
[0139] Fifth, after receiving the query results returned by the backend server, the web frontend parses the total number of newly added data and makes a judgment. If the total number of newly added data is greater than 0 (e.g., total=5), the computer device will pop up a reminder message on the frontend page. For example, the reminder message can be "There are currently 5 new messages that meet the filter criteria. Please refresh the list to view them." This reminder message includes a "refresh" button for the user to click to trigger a subsequent list update. If the total number of newly added data is equal to 0, the computer device will silently process this push, without popping up any reminders on the frontend page, and will only record "No data meets the criteria for this push, silent processing" in the console to avoid causing unnecessary disturbance to the user.
[0140] Step 6: After the user clicks the "Refresh" button in the notification message, the computer device responds to the refresh operation by sending a complete data retrieval request to the backend server, carrying the target filter criteria. The backend server queries one or more complete new data records that meet the target filter criteria and obtains 5 complete new message records. The backend server returns the retrieved complete new data to the web frontend. After receiving the complete new data returned by the backend server, the computer device updates the list display area, rendering and displaying the new data in the message list. If the user does not click the refresh button, the list maintains its original data display state, the WebSocket connection remains open, and it waits for the next push notification signal from the backend server.
[0141] It should be noted that during the actual implementation process, the parameters in Table 1 can be flexibly configured to adapt to different business scenarios, as shown in Table 1 below:
[0142] Parameter name default value Configurable range Function Description Filtering dwell time 2 seconds 1-5 seconds This is used to determine whether a user has completed the filtering process, preventing invalid push notifications from being triggered when users frequently switch filter criteria. WebSocket connection timeout 30 seconds Adjust according to network environment The automatic reconnection mechanism is triggered after a timeout to ensure connection stability. Backend server data monitoring interval 1 second Adjusted based on data addition frequency Balancing the real-time nature of data monitoring with server query load
[0143] Table 1
[0144] It should be noted that the above steps are only illustrative. In actual applications, the number of filtering conditions, data types, and reminder formats can be flexibly adjusted according to specific business needs. This application embodiment does not impose any restrictions on this.
[0145] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0146] Based on the same inventive concept, this application also provides a WebSocket-based filtering and linkage incremental message reminder device for implementing the WebSocket-based filtering and linkage incremental message reminder method described above. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations of one or more WebSocket-based filtering and linkage incremental message reminder device embodiments provided below can be found in the limitations of the WebSocket-based filtering and linkage incremental message reminder method described above, and will not be repeated here.
[0147] In one exemplary embodiment, such as Figure 7 As shown, a WebSocket-based filtering and linked incremental message notification device is provided for use in web front-ends, including:
[0148] The first connection module 111 is used to establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0149] The first monitoring module 112 is used to monitor the filtering operation triggered by the user and cache the target filtering conditions corresponding to the filtering operation.
[0150] The first receiving module 113 is used to receive a notification signal transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0151] The first output module 114 is used to respond to a notification signal by sending an incremental query request to the backend server based on the target filtering conditions and the timestamp of the first data in the current list, in order to obtain the number of newly added data that meet the target filtering conditions, and to determine whether to output a reminder message based on the query results.
[0152] In one embodiment, the first monitoring module 112 includes:
[0153] An operation unit is used to monitor the filtering operations triggered by the user in the filter criteria area of the web page and record the last operation time of the filtering operation; the filtering operation includes at least one of the user's operation of checking, toggling and canceling the filter criteria;
[0154] The update unit is used to update the last operation time when a change in the screening criteria is detected.
[0155] The write unit is used to determine that the user has completed the filtering operation when the time interval between the current time and the last operation time reaches a preset dwell time, and writes all current filtering conditions as target filtering conditions into the local cache.
[0156] In one embodiment, the above-mentioned WebSocket-based filtering and incremental message notification device further includes a first display module 115, which includes:
[0157] The refresh unit is used to respond to the user's refresh operation based on the reminder information, and to request the complete new data that meets the target filter conditions from the backend server.
[0158] The first return unit is used to receive and display the complete new data that meets the target filtering criteria returned by the backend server.
[0159] In one embodiment, the first output module 114 includes:
[0160] The alert unit is used to output an alert message when the number of newly added data to the target in the query results is greater than zero;
[0161] The silent unit is used to silently process the notification signal when the query result shows that the number of newly added data to the target is zero.
[0162] In one exemplary embodiment, such as Figure 8 As shown, another WebSocket-based filtering and incremental message notification device is provided, applied to a backend server, including:
[0163] The second connection module 221 is used to establish a real-time communication connection with the Web front-end based on the WebSocket protocol;
[0164] The second monitoring module 222 is used to send a notification signal to the Web front-end through a real-time communication connection when new data is detected in the pre-built database, so as to trigger the Web front-end to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0165] The second receiving module 223 is used to receive the incremental query request sent by the Web front end and query the number of new data to be added based on the incremental query request.
[0166] The second output module 224 is used to return the query results to the Web front end so that the Web front end can determine whether to output a reminder message based on the query results.
[0167] In one embodiment, the above-mentioned WebSocket-based filtering and incremental message notification device further includes a second display module 225, which includes:
[0168] The retrieval unit is used to respond to a complete data retrieval request sent by the web frontend upon triggering a notification message; wherein, the complete data retrieval request carries the target filtering conditions;
[0169] The second return unit is used to query the complete new data that meets the target filter conditions, and return the complete new data to the web front end so that the web front end can display the complete new data.
[0170] The modules in the aforementioned WebSocket-based filtering and incremental message notification device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can call and execute the corresponding operations of each module.
[0171] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a WebSocket-based method for filtering and linking incremental message notifications. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0172] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0173] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0174] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0175] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0176] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0177] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0178] Monitor filtering operations triggered by users in the filter criteria area of a web page, and record the last operation time of the filtering operation; the filtering operation includes at least one of the user's actions of checking, toggling, and canceling the filter criteria;
[0179] Update the last operation time if a change in the screening criteria is detected.
[0180] If the time interval between the current moment and the last operation time reaches the preset dwell time, it is determined that the user has completed the filtering operation, and all current filtering conditions are written to the local cache as target filtering conditions.
[0181] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0182] In response to the user's refresh operation based on the reminder information, the system requests the complete new data that meets the target filter criteria from the backend server.
[0183] Receive and display complete new data that matches the target filtering criteria returned by the backend server.
[0184] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0185] If the query results show that the number of newly added data to the target is greater than zero, output a notification message;
[0186] If the query result shows that the number of newly added data to the target is zero, the notification signal transmitted will be processed silently.
[0187] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0188] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0189] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0190] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0191] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0192] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0193] Responding to a complete data retrieval request sent by the web frontend upon triggering a notification message; wherein the complete data retrieval request carries the target filtering conditions;
[0194] Query the complete newly added data that meets the target filter criteria, and return the complete newly added data to the web frontend so that the web frontend can display the complete newly added data.
[0195] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0196] Establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0197] Monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations;
[0198] It receives notification signals transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0199] In response to the notification signal, based on the target filtering criteria and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of newly added data that meet the target filtering criteria, and the query results determine whether to output a reminder message.
[0200] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0201] Monitor filtering operations triggered by users in the filter criteria area of a web page, and record the last operation time of the filtering operation; the filtering operation includes at least one of the user's actions of checking, toggling, and canceling the filter criteria;
[0202] Update the last operation time if a change in the screening criteria is detected.
[0203] If the time interval between the current moment and the last operation time reaches the preset dwell time, it is determined that the user has completed the filtering operation, and all current filtering conditions are written to the local cache as target filtering conditions.
[0204] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0205] In response to the user's refresh operation based on the reminder information, the system requests the complete new data that meets the target filter criteria from the backend server.
[0206] Receive and display complete new data that matches the target filtering criteria returned by the backend server.
[0207] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0208] If the query results show that the number of newly added data to the target is greater than zero, output a notification message;
[0209] If the query result shows that the number of newly added data to the target is zero, the notification signal transmitted will be processed silently.
[0210] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0211] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0212] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0213] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0214] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0215] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0216] Responding to a complete data retrieval request sent by the web frontend upon triggering a notification message; wherein the complete data retrieval request carries the target filtering conditions;
[0217] Query the complete newly added data that meets the target filter criteria, and return the complete newly added data to the web frontend so that the web frontend can display the complete newly added data.
[0218] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0219] Establish a real-time communication connection with the backend server based on the WebSocket protocol;
[0220] Monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations;
[0221] It receives notification signals transmitted by the backend server through a real-time communication connection when new data is detected; the notification signal is an incremental snapshot notification signal and does not contain specific data content.
[0222] In response to the notification signal, based on the target filtering criteria and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of newly added data that meet the target filtering criteria, and the query results determine whether to output a reminder message.
[0223] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0224] Monitor filtering operations triggered by users in the filter criteria area of a web page, and record the last operation time of the filtering operation; the filtering operation includes at least one of the user's actions of checking, toggling, and canceling the filter criteria;
[0225] Update the last operation time if a change in the screening criteria is detected.
[0226] If the time interval between the current moment and the last operation time reaches the preset dwell time, it is determined that the user has completed the filtering operation, and all current filtering conditions are written to the local cache as target filtering conditions.
[0227] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0228] In response to the user's refresh operation based on the reminder information, the system requests the complete new data that meets the target filter criteria from the backend server.
[0229] Receive and display complete new data that matches the target filtering criteria returned by the backend server.
[0230] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0231] If the query results show that the number of newly added data to the target is greater than zero, output a notification message;
[0232] If the query result shows that the number of newly added data to the target is zero, the notification signal transmitted will be processed silently.
[0233] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0234] Establish a real-time communication connection with the web frontend based on the WebSocket protocol;
[0235] When new data is detected in the pre-built database, a notification signal is sent to the web frontend via a real-time communication connection to trigger the web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list.
[0236] Receive incremental query requests sent by the web frontend, and query the number of new data to be added based on the incremental query requests;
[0237] The query results are returned to the web frontend so that the web frontend can determine whether to output a reminder message based on the query results.
[0238] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0239] Responding to a complete data retrieval request sent by the web frontend upon triggering a notification message; wherein the complete data retrieval request carries the target filtering conditions;
[0240] Query the complete newly added data that meets the target filter criteria, and return the complete newly added data to the web frontend so that the web frontend can display the complete newly added data.
[0241] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0242] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 application.
[0243] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for filtering and linking incremental message notifications based on WebSocket, characterized in that, Applied to web front-ends, the method includes: Establish a real-time communication connection with the backend server based on the WebSocket protocol; Monitor user-triggered filtering operations and cache the target filtering conditions corresponding to the filtering operations; The system receives a notification signal transmitted by the backend server through the real-time communication connection when it detects new data; the notification signal is an incremental snapshot notification signal and does not contain specific data content. In response to the notification signal, based on the target filtering conditions and the timestamp of the first data in the current list, an incremental query request is sent to the backend server to obtain the number of newly added data that meet the target filtering conditions, and a reminder message is determined based on the query results.
2. The method according to claim 1, characterized in that, The monitoring of user-triggered filtering operations and caching of the target filtering conditions corresponding to the filtering operations include: Monitor the filtering operations triggered by the user in the filter criteria area of the web page, and record the last operation time of the filtering operation; the filtering operation includes at least one of the user's operation of checking, switching and canceling the filter criteria; If a change in the filtering criteria is detected, the last operation time is updated. If the time interval between the current moment and the last operation time reaches a preset dwell time, it is determined that the user has completed the filtering operation, and all current filtering conditions are written to the local cache as the target filtering conditions.
3. The method according to claim 1, characterized in that, The method further includes: In response to a refresh operation input by the user based on the reminder information, the system requests the backend server to obtain complete new data that meets the target filtering criteria, carrying the target filtering criteria. Receive and display the complete new data that meets the target filtering criteria returned by the backend server.
4. The method according to claim 1, characterized in that, The step of determining whether to output a reminder message based on the query results includes: If the query result shows that the number of newly added data for the target is greater than zero, the reminder message will be output. If the query result shows that the number of newly added data to the target is zero, the notification signal transmitted will be processed silently.
5. A method for filtering and linking incremental message notifications based on WebSocket, characterized in that, Applied to a backend server, the method includes: Establish a real-time communication connection with the web frontend based on the WebSocket protocol; When new data is detected in the pre-built database, a notification signal is sent to the Web frontend through the real-time communication connection to trigger the Web frontend to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list. Receive the incremental query request sent by the Web frontend, and query the number of new data to be added based on the incremental query request; The query results are returned to the web front-end so that the web front-end can determine whether to output a reminder message based on the query results.
6. The method according to claim 5, characterized in that, The method further includes: In response to a complete data retrieval request sent by the web frontend upon triggering the notification message; wherein the complete data retrieval request carries the target filtering conditions; The system queries complete new data that meets the target filtering criteria and returns the complete new data to the web front-end for display.
7. A WebSocket-based filtering and linked incremental message notification device, characterized in that, The device, used in web front-ends, includes: The first connection module is used to establish a real-time communication connection with the backend server based on the WebSocket protocol; The first monitoring module is used to monitor the filtering operation triggered by the user and cache the target filtering conditions corresponding to the filtering operation. The first receiving module is used to receive a notification signal transmitted by the backend server through the real-time communication connection when it detects new data; the notification signal is an incremental snapshot notification signal and does not contain specific data content. The first output module is used to respond to the notification signal, send an incremental query request to the backend server according to the target filtering conditions and the timestamp of the first data in the current list, to obtain the number of newly added data that meet the target filtering conditions, and determine whether to output a reminder message based on the query results.
8. A WebSocket-based filtering and linked incremental message notification device, characterized in that, The device, applied to a backend server, includes: The second connection module is used to establish a real-time communication connection with the web front-end based on the WebSocket protocol; The second monitoring module is used to send a notification signal to the Web front-end through the real-time communication connection when new data is detected in the pre-built database, so as to trigger the Web front-end to send an incremental query request based on the cached target filtering conditions and the timestamp of the first data in the current list. The second receiving module is used to receive the incremental query request sent by the Web front-end, and query the number of new data to be added according to the incremental query request; The second output module is used to return the query results to the web front-end, so that the web front-end can determine whether to output a reminder message based on the query results.
9. A WebSocket-based filtering and linked incremental message notification system, characterized in that, Includes web front-end and back-end servers; The web front-end is used to execute the WebSocket-based filtering and linkage incremental message notification method as described in any one of claims 1-4; The backend server is used to execute the WebSocket-based filtering and linkage incremental message notification method as described in any one of claims 5-6.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
