Lightweight desktop alarm methods, systems, and storage media for consoles
By building network event interfaces and notification classes on the front end to obtain the desktop notification request status, the problems of complex WebSocket alarm configuration and high resource consumption are solved, realizing efficient console-based lightweight desktop alarms and optimizing front-end performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU YUNDI TECH CO LTD
- Filing Date
- 2023-02-24
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, console alerts via WebSocket are complex to configure and consume a lot of page resources. Web page alerts are easily lost, and desktop notifications generally require additional tray software, resulting in low cost-effectiveness.
By building a network event interface to receive backend information on the front end, adjusting the data structure, building a notification class and obtaining the desktop prompt request status, desktop alerts are implemented, reducing page resource usage and optimizing front-end performance.
It effectively reduces the amount of configuration and code, lowers the maintenance difficulty, improves front-end performance, and achieves efficient desktop alarm notifications.
Smart Images

Figure CN116319257B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a lightweight desktop alarm method, system, and storage medium for a console. Background Technology
[0002] Currently, after setting up alarm management in the console, alarms are sent to users periodically. The relevant technologies primarily utilize WebSocket for communication. WebSocket is a protocol for full-duplex communication over a single TCP connection. Through a handshake mechanism, the client and server can establish a TCP-like connection, facilitating communication. However, WebSocket communication requires more configuration, and long-term connections consume more page resources; webpage notifications are also easily lost when the page is closed. Furthermore, typical desktop notifications require additional tray software, which involves a significant workload. Summary of the Invention
[0003] To address at least one of the aforementioned technical problems, this invention proposes a lightweight desktop alarm method, system, and storage medium for a console, which can realize desktop alarm prompts, reduce the use of page resources, optimize front-end performance, and effectively reduce configuration and code volume.
[0004] On one hand, embodiments of the present invention provide a lightweight desktop alerting method for a console, comprising the following steps:
[0005] Construct a network event interface; wherein the network event interface is set on the front end, and the front end receives the first information sent by the back end through the network event interface;
[0006] When the first information is received, the data structure of the first information is adjusted to obtain the second information;
[0007] Construct a notification class and store the second information in the notification class;
[0008] Obtain the desktop notification request status; wherein, the desktop notification request status includes an agreement status;
[0009] When the desktop prompt request status is "agree", a desktop alarm is triggered based on the data stored in the notification class.
[0010] A lightweight desktop alerting method for a console according to an embodiment of the present invention has at least the following beneficial effects: Firstly, this embodiment constructs a network event interface on the front end to receive first information sent from the back end. Then, upon receiving the first information, the data structure of the first information is adjusted to unify the data structure, resulting in second information. Further, this embodiment constructs a notification class and stores the second information in the notification class. Simultaneously, this embodiment obtains the desktop notification request status to retrieve desktop alert permissions. When the desktop notification request status is "agree," a desktop alert is triggered based on the data stored in the notification class, thus implementing desktop alert notification, reducing page resource usage, optimizing front-end performance, and compared to WebSocket and tray notifications, this embodiment effectively reduces configuration and code volume, making maintenance easier.
[0011] According to some embodiments of the present invention, after performing the step of constructing the network event interface, the method further includes:
[0012] Add a timer; wherein the timer is used to maintain communication between the front end and the back end.
[0013] According to some embodiments of the present invention, adjusting the data structure of the first information to obtain the second information includes:
[0014] Extract the message-type content from the first information to obtain the second information.
[0015] According to some embodiments of the present invention, the desktop notification request status further includes a rejection status;
[0016] After performing the step of obtaining the desktop prompt request status, the method further includes:
[0017] When the desktop prompt request status is the rejected status, a page prompt is generated based on the data stored in the notification class.
[0018] According to some embodiments of the present invention, before performing the step of obtaining the desktop prompt request status, the method includes:
[0019] Construct a desktop notification request subfunction; wherein, desktop alarm permissions are obtained through the desktop notification request subfunction.
[0020] According to some embodiments of the present invention, when the desktop prompt request status is the consent status, the step of generating a desktop alarm based on the data stored in the notification class includes:
[0021] Construct a notification function; wherein the notification function includes a notification title and notification information;
[0022] When the desktop prompt request subfunction is called and the desktop prompt request status is "agree", the corresponding desktop alarm notification is generated through the notification function.
[0023] According to some embodiments of the present invention, the notification class includes a notification icon and a notification body;
[0024] The step of storing the second information in the notification class includes:
[0025] The second information is stored in the notification body of the notification class.
[0026] On the other hand, embodiments of the present invention also provide a lightweight desktop alarm system for a console, comprising:
[0027] The first construction module is used to construct a network event interface; wherein, the network event interface is set on the front end, and the front end receives the first information sent by the back end through the network event interface;
[0028] An adjustment module is used to adjust the data structure of the first information when the first information is received to obtain the second information;
[0029] The second construction module is used to construct a notification class and store the second information in the notification class;
[0030] The acquisition module is used to acquire the desktop prompt request status; wherein, the desktop prompt request status includes an agreement status;
[0031] The alarm module is used to issue a desktop alarm based on the data stored in the notification class when the desktop prompt request status is the agreed status.
[0032] On the other hand, embodiments of the present invention also provide a lightweight desktop alarm system for a console, comprising:
[0033] At least one processor;
[0034] At least one memory for storing at least one program;
[0035] When the at least one program is executed by the at least one processor, the at least one processor implements the console lightweight desktop alerting method as described in the above embodiments.
[0036] On the other hand, embodiments of the present invention also provide a computer storage medium storing a processor-executable program, which, when executed by the processor, is used to implement the console lightweight desktop alarm method as described in the above embodiments. Attached Figure Description
[0037] Figure 1 This is a flowchart of the lightweight desktop alarm method for console provided in an embodiment of the present invention;
[0038] Figure 2 This is a block diagram of the lightweight desktop alarm system for console provided in an embodiment of the present invention. Detailed Implementation
[0039] The embodiments described in this application should not be considered as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0040] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0042] Before describing the embodiments of this application, the relevant terms involved in this application will be explained.
[0043] WebSocket is a new protocol in HTML5 (essentially a TCP-based protocol). It enables full-duplex communication between the browser and the server, saving server resources and bandwidth while achieving real-time communication. WebSocket is also a persistent protocol. It defines a communication standard, using a handshake mechanism to establish a TCP-like connection between the client and server, facilitating communication. Once the WebSocket connection is established, subsequent data is transmitted in frame sequences. The client and server do not need to re-initiate a connection request until the client disconnects or the server interrupts the connection. Under high concurrency and heavy client-server interaction loads, it significantly saves network bandwidth, offering a clear performance advantage. Furthermore, the client sends and receives messages over the same persistent connection, achieving long-lived connections.
[0044] Currently, after alarm management is set up in the console, such as in the Process Easy console, alarms are sent to users periodically. The main technology used for communication is WebSocket. However, WebSocket communication requires extensive configuration, and long-term connections consume more page resources; also, webpage notifications are easily lost when the page is closed. Furthermore, typical desktop notifications require additional tray software, which is quite labor-intensive. Therefore, using WebSocket for desktop alarms results in high energy and resource consumption, making it less cost-effective.
[0045] Based on this, one embodiment of the present invention provides a lightweight desktop alerting method, system, and storage medium for a console, which can realize desktop alert notifications, reduce page resource usage, optimize front-end performance, and effectively reduce configuration and code volume. (See also...) Figure 1 The method in this embodiment of the invention includes, but is not limited to, steps S110, S120, S130, S140 and S150.
[0046] Specifically, the application process of the method in this embodiment of the invention includes, but is not limited to, the following steps:
[0047] S110: Construct a network event interface. The network event interface is set up at the front end, through which the first information sent by the back end is received.
[0048] S120: When the first information is received, the data structure of the first information is adjusted to obtain the second information.
[0049] S130: Construct a notification class and store the second information in the notification class.
[0050] S140: Obtain the desktop notification request status. The desktop notification request status includes the consent status.
[0051] S150: When the desktop prompt indicates that the request status is "agree", a desktop alarm is triggered based on the data stored in the notification class.
[0052] In this specific embodiment, the first step is to construct a network event interface. Specifically, the network event interface (eventsource) is set up on the front end. By adding the network event interface (eventsource) to the front end, communication between the front end and the back end is achieved through the network event interface, and the first information sent by the back end is received. Further, when the first information is received, the data structure of the first information is adjusted to obtain the second information. It is easy to understand that after the front end receives the first information through the network event interface, since the information received by the network data interface is in JSON format, the data structure of the received first information needs to be adjusted. Next, this embodiment constructs a notification class. Specifically, this embodiment first creates a new Notification class. Then, the second information is stored in this Notification class. Then, this embodiment obtains the desktop notification request status to obtain permission for desktop alerts. Specifically, this embodiment needs to obtain permission for desktop alerts from the user before issuing a desktop alert. It should be noted that after obtaining the desktop notification request status as "agree," the user can set the browser to not remind them again, thus avoiding the need to request permission every time information is received. Furthermore, when the desktop notification request status is in an "agree" state, a desktop alert is triggered based on the data stored in the notification class. Specifically, after receiving a message through real-time communication, this embodiment obtains permission for a desktop alert by invoking the desktop notification request status. When the desktop notification request status is in an "agree" state, this embodiment triggers a desktop alert based on the data stored in the notification class, thereby achieving the effect of a desktop notification. This embodiment uses a network event interface for real-time communication, and after receiving the first information returned by the network event interface at the front end, it generates a desktop notification through the notification class, thus eliminating the need for bidirectional communication or rewriting the notification component to display the page notification, effectively alleviating memory pressure. Simultaneously, this embodiment eliminates the need to use WebSocket or rewrite tray software for desktop alerts, effectively reducing page resource usage, lowering maintenance difficulty, and significantly improving front-end performance.
[0053] In some embodiments of the present invention, after performing the step of building the network event interface, the lightweight desktop alarm method for the console provided in this embodiment also includes, but is not limited to:
[0054] Add a timer. The timer is used to maintain communication between the front-end and back-end.
[0055] In this specific embodiment, a timer is added during the communication between the front-end and back-end via the network event source to maintain communication. Specifically, this embodiment maintains communication by adding a timer during the communication process, thereby achieving real-time reception of information sent by the back-end. It is easy to understand that this embodiment achieves an effect similar to the fast reconnection mechanism of WebSockets, i.e., a heartbeat mechanism, by setting a timer. In the heartbeat mechanism, a data packet is sent to the server at regular intervals to indicate that the client is still online. Simultaneously, the client confirms whether the server is still online. If it is, the server sends a data packet back to the client to confirm that it is also online; otherwise, if the network connection is lost, a reconnection is initiated. This embodiment adds a timer during connection communication via the network event source to ensure the immediacy of communication between the front-end and back-end, maintaining their communication.
[0056] In some embodiments of the present invention, the data structure of the first information is adjusted to obtain the second information, including but not limited to:
[0057] Extract the message-type content from the first information to obtain the second information.
[0058] In this specific embodiment, the message content is extracted from the first information to adjust its data structure. Specifically, in this embodiment, the first information received by the network event interface (eventsource) is a JSON format data packet, therefore, the data structure of the received first information needs to be adjusted. This embodiment extracts the message content from the first information and stores the extracted message content as the second information.
[0059] In some embodiments of the present invention, the desktop notification request status also includes a rejection status. Accordingly, after performing the step of obtaining the desktop notification request status, the lightweight desktop alerting method for the console provided in this embodiment also includes, but is not limited to:
[0060] When the desktop prompts that the request status is rejected, a page prompt is displayed based on the data stored in the notification class.
[0061] In this specific embodiment, when obtaining the desktop notification request status, the desktop notification request status also includes a rejected status. Specifically, when granting desktop alert permissions to a user, the user can set the desktop notification request status according to their needs, including an agreed status and a rejected status. It is easy to understand that desktop alert permissions can only be obtained and desktop alert operations can be performed when the obtained desktop notification request status is an agreed status. Correspondingly, when the obtained desktop notification request status is a rejected status, that is, the user has not authorized desktop alerts, this embodiment provides a page notification based on the data stored in the notification class. This embodiment provides alerts through page notifications to alleviate the problem of not being able to alert the user when desktop alert permissions are not obtained, thereby improving the reliability and timeliness of alerts.
[0062] In some embodiments of the present invention, before performing the step of obtaining the desktop prompt request status, the lightweight desktop alarm method for the console provided in this embodiment also includes, but is not limited to:
[0063] Construct a desktop alert request subfunction. This subfunction is used to obtain desktop alert permissions.
[0064] In this specific embodiment, before obtaining the desktop alert request status, a desktop alert request sub-function is first constructed to obtain desktop alert permissions. Specifically, this embodiment constructs a function to obtain desktop alert permissions, i.e., the desktop alert request sub-function. This embodiment obtains desktop alert permissions by calling this function to obtain the desktop alert request status. When the front end receives the first information sent by the back end in real time through the network event interface, it obtains desktop alert permissions from the user by calling the constructed desktop alert request sub-function. It should be noted that in some embodiments of the present invention, the setting of the desktop alert request status does not require obtaining desktop alert permissions through the desktop alert request sub-function every time a message is received. In this embodiment, when obtaining desktop alert permissions from the user for the first time, the timeliness of the alert permissions can be set, such as obtaining desktop alert permissions periodically, or setting it as a permanent permission authorization, that is, after obtaining the desktop alert permissions, the user will not be reminded to set the desktop alert request status again.
[0065] In some embodiments of the present invention, when the desktop prompt request status is in an "agree" state, a desktop alarm is triggered based on data stored in the notification class, including but not limited to:
[0066] Construct a notification function. This function includes a notification title and a notification message.
[0067] When the desktop notification request subfunction is called and the desktop notification request status is "agreed", the corresponding desktop alarm notification is generated through the notification function.
[0068] In this specific embodiment, a notification function is constructed to generate corresponding desktop alert notifications. Specifically, this embodiment first constructs a notification function that includes a notification title and notification information; that is, the constructed notification function includes the notification title and notification content. Upon receiving the first message from the backend, this embodiment first verifies the permissions for the desktop alert, that is, it determines whether the desktop alert request status obtained through the desktop alert request subfunction is in an "agree" state. When the desktop alert request status is in an "agree" state, this embodiment generates the corresponding desktop alert notification through the notification function based on the corresponding notification title and notification information, thereby achieving the desktop alert effect.
[0069] In some embodiments of the present invention, the notification class includes a notification icon and a notification body. Accordingly, in this embodiment, second information is stored in the notification class, including but not limited to:
[0070] The second piece of information is stored in the notification body of the notification class.
[0071] In this specific embodiment, the notification class constructed includes a notification icon and a notification body. Specifically, the notification class constructed in this embodiment includes a notification icon and a notification body. The received second information is stored in the notification body. The second information extracted from the first information is stored in the notification body of the notification class. When a desktop alarm is needed, the corresponding second information is retrieved from the notification body of the notification class to generate a desktop alarm notification.
[0072] An embodiment of the present invention also provides a lightweight desktop alarm system for consoles, comprising:
[0073] The first construction module is used to build the network event interface. This network event interface is set up on the front end and receives the first information sent from the back end through it.
[0074] The adjustment module is used to adjust the data structure of the first information when it is received to obtain the second information.
[0075] The second construction module is used to build the notification class and store the second information in the notification class.
[0076] The acquisition module is used to obtain the status of the desktop notification request. The desktop notification request status includes the consent status.
[0077] The alarm module is used to generate desktop alarms based on the data stored in the notification class when the desktop prompt request status is "agree".
[0078] Reference Figure 2 An embodiment of the present invention also provides a lightweight desktop alarm system for consoles, comprising:
[0079] At least one processor 210.
[0080] At least one memory 220 is used to store at least one program.
[0081] When at least one program is executed by at least one processor 210, the at least one processor 210 implements the console lightweight desktop alerting method as described in the above embodiments.
[0082] An embodiment of the present invention also provides a computer-readable storage medium storing computer-executable instructions that are executed by one or more control processors, for example, performing the steps described in the above embodiments.
[0083] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0084] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. A lightweight desktop alerting method for a console, characterized in that, Includes the following steps: Construct a network event interface; wherein the network event interface is set on the front end, and the front end receives first information sent by the back end through the network event interface; wherein the network event interface is an eventsource; When the first information is received, the data structure of the first information is adjusted to obtain the second information; Construct a notification class and store the second information in the notification class; Obtain the desktop notification request status; wherein, the desktop notification request status includes an agreement status; When the desktop prompt request status is the agreed status, a desktop alarm is triggered via the Notification API based on the data stored in the notification class. The step of adjusting the data structure of the first information to obtain the second information includes: Extract message-type content from the first information to obtain the second information; Before performing the step of obtaining the desktop prompt request status, the method includes: Construct a desktop alert request subfunction; wherein, the desktop alert request subfunction obtains desktop alert permissions from the user; The desktop notification request status also includes a rejected status; After performing the step of obtaining the desktop prompt request status, the method further includes: When the desktop prompt request status is the rejected status, a page prompt is generated based on the data stored in the notification class.
2. The lightweight desktop alarm method for consoles according to claim 1, characterized in that, After performing the step of building the network event interface, the method further includes: Add a timer; wherein the timer is used to maintain communication between the front end and the back end.
3. The lightweight desktop alarm method for consoles according to claim 1, characterized in that, When the desktop prompt request status is in the "agree" state, the desktop alarm is triggered based on the data stored in the notification class, including: Construct a notification function; wherein the notification function includes a notification title and notification information; When the desktop prompt request subfunction is called and the desktop prompt request status is "agree", the corresponding desktop alarm notification is generated through the notification function.
4. The lightweight desktop alarm method for consoles according to claim 1, characterized in that, The notification class includes a notification icon and a notification body; The step of storing the second information in the notification class includes: The second information is stored in the notification body of the notification class.
5. A lightweight desktop alarm system for consoles, characterized in that, include: The first construction module is used to construct a network event interface; wherein the network event interface is set on the front end, and the front end receives first information sent by the back end through the network event interface; wherein the network event interface is an eventsource; An adjustment module is used to adjust the data structure of the first information when the first information is received to obtain the second information; The second construction module is used to construct a notification class and store the second information in the notification class; The acquisition module is used to acquire the desktop prompt request status; wherein, the desktop prompt request status includes an agreement status; The alarm module is used to issue a desktop alarm via the Notification API based on the data stored in the notification class when the desktop prompt request status is the consent status. The step of adjusting the data structure of the first information to obtain the second information includes: Extract message-type content from the first information to obtain the second information; Before performing the step of obtaining the desktop prompt request status, the following steps are included: Construct a desktop alert request subfunction; wherein, the desktop alert request subfunction obtains desktop alert permissions from the user; The desktop notification request status also includes a rejected status; The acquisition module further includes: When the desktop prompt request status is the rejected status, a page prompt is generated based on the data stored in the notification class.
6. A lightweight desktop alarm system for consoles, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the console lightweight desktop alerting method as described in any one of claims 1 to 5.
7. A computer storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to implement the console lightweight desktop alerting method as described in any one of claims 1 to 5.