Message callback method, device, storage medium and computer equipment
Through the message callback method, a network connection is established between the terminal device and the digital network device and the domain name service status is configured. The web page access request is only sent when the connection and service are ready, which solves the high system resource loss rate caused by frequent requests in the existing technology. problem and achieve more efficient resource utilization.
Patent Information
- Application Number
- CN202210293463.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-03-23
AI Technical Summary
In the existing technology, after a terminal device establishes a network connection with a digital network device, the application frequently sends domain name address requests to the domain name resolution component, resulting in a high system resource loss rate and the inability to obtain the IP address corresponding to the domain name address in a timely manner.
Through the message callback method, establish a network connection and receive domain name service information from the domain name server, configure the domain name service status, and only send web page access requests when the network connection is successful and the domain name service is ready to avoid frequent domain name resolution processes.
It reduces the loss rate of system resources, avoids executing invalid domain name resolution processes when the domain name service is not ready, and improves the utilization of system resources.
Smart Images

Figure CN114866611B
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a message callback method, apparatus, storage medium, and computer device. Background Technology
[0002] When an application initiates a network access request, it sends the domain name address to be resolved to the domain name resolution component of the terminal device. The domain name resolution component generates a domain name resolution request corresponding to the domain name address, and then sends the domain name resolution request to the corresponding domain name resolution server to obtain the IP address (Internet Protocol Address) corresponding to the domain name resolution request. This allows the application to access the network based on the received IP address. Summary of the Invention
[0003] This application provides a message callback method, apparatus, storage medium, and computer device, which can solve the technical problem of how to reduce the consumption rate of system resources.
[0004] In a first aspect, embodiments of this application provide a message callback method, the method comprising:
[0005] If a network connection is established with a data network device, the network connection status of the network connection is set to a network connection successful status;
[0006] Receive domain name service information from the domain name server provided by the data network device;
[0007] Configure domain name services based on the domain name service information and determine the domain name service status;
[0008] Send the network connection success status and the domain name service status to the application;
[0009] The network connection success status and the domain name service status are used to indicate the initiation status of the application's web page access request.
[0010] Secondly, embodiments of this application provide a message callback device, including:
[0011] The network determination module is used to set the network connection status of a network connection to a successful network connection status if a network connection is established with a data network device.
[0012] The information receiving module is used to receive domain name service information from the domain name server provided by the data network device;
[0013] The domain name configuration module is used to configure domain name services and determine the domain name service status based on the domain name service information.
[0014] A status indication module is used to send the network connection success status and the domain name service status to the application; wherein the network connection success status and the domain name service status are used to indicate the initiation status of the application's web page access request.
[0015] Thirdly, embodiments of this application provide a storage medium storing a computer program adapted to be loaded by a processor and to execute the steps of the above-described method.
[0016] Fourthly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method described above.
[0017] In this embodiment, if the message callback device has already established a network connection with the data network device, the network connection status of the network connection is set to a successful network connection status. Then, based on the network connection, the domain name service information of the domain name server provided by the data network device is obtained. Based on the domain name service information, the domain name service of the message callback device is configured. Then, the domain name service status is determined according to the configuration process of the domain name service. Finally, the successful network connection status and the domain name service status are sent to the application. This ensures that the application will only send the web page access request to the domain name resolution component when both the network service and the domain name service of the message callback device are ready. In the case that the domain name service is not ready, the frequent generation and sending of web page access requests and execution of the domain name resolution process are avoided, but the Internet Protocol corresponding to the domain name address cannot be obtained. This reduces the system resource consumption rate by reducing unnecessary system running processes. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A device architecture diagram of a message callback device provided in an embodiment of this application;
[0020] Figure 2 A flowchart illustrating a message callback method provided in an embodiment of this application;
[0021] Figure 3 A flowchart illustrating a message callback method provided in an embodiment of this application;
[0022] Figure 4 A flowchart illustrating a message callback method provided in an embodiment of this application;
[0023] Figure 5 A flowchart illustrating a message callback method provided in an embodiment of this application;
[0024] Figure 6 This is a schematic diagram of the structure of a message callback device provided in an embodiment of this application;
[0025] Figure 7 This is a schematic diagram of the structure of a message callback device provided in an embodiment of this application;
[0026] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0027] To make the features and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] In existing technologies, when a terminal device establishes a network connection with a digital network device, it sends a successful network connection message to the application. Upon receiving this message, the application sends the domain name address to be resolved to the domain name resolution component. However, since the domain name resolution component may not be fully configured at this point, it cannot obtain the IP address corresponding to the domain name address and therefore cannot return the required IP address to the application. Consequently, the application continuously sends the domain name address to be resolved because it has not received the IP address, resulting in extremely high system resource consumption.
[0029] To further reduce system resource consumption, please refer to [link / reference]. Figure 1 This is a device architecture diagram of a message callback device provided in the embodiments of this specification.
[0030] like Figure 1 As shown, the device architecture of message callback device 1 may include: network connection component 10, service control component 20, domain name resolution component 30 and application 40, wherein the domain name resolution component 30 includes service configuration module 31 and domain name service module 32.
[0031] The message callback device 1 can be various electronic devices, including but not limited to smartphones, tablets, laptops, and desktop computers, without specific limitations.
[0032] The network connection component 10 is used to establish a communication link between the message callback device 1 and the data network device 01. The data network device 01 can be a base station (an interface device for mobile devices to access the Internet), a wireless access point device, or other interface device for accessing the Internet.
[0033] Service control component 20 is used to control network connection component 10, domain name resolution component 30, and application 40. Specifically, service control component 20 can obtain the network connection status of network connection component 10; it can also obtain domain name service messages from the domain name server sent by network connection component 10, control domain name resolution component 30 to perform domain name service configuration, and thus obtain the domain name service status of domain name resolution component 30; it can also send the obtained network connection status and domain name service status to application 40 through the message callback interface in service control component 20.
[0034] The domain name resolution component 30 is used to provide domain name resolution services to the application. Specifically, the service configuration module 31 updates the domain name service data based on the received domain name service information, and then configures the domain name service module 32 to access the domain name server 02. That is, the message callback device 1 can obtain the domain name resolution service provided by the domain name server 02 through the domain name service module 32. The domain name server 02 (DNS) is a server that translates domain names into their corresponding IP addresses.
[0035] Application 40 refers to a program that has the ability to initiate web page access requests, such as a browser.
[0036] When the network connection component 10 receives a network connection command from the service control component 20, it obtains the network service information of the data network device 01 in the environment where the message callback device 1 is located, and then establishes a network connection between the message callback device 1 and the data network device 01 based on the network service information. When the network connection is successful, the network connection component 10 sends a network connection success notification message to the service control component 20.
[0037] When the service control component 20 receives a network connection success message, it sets the network connection status of the message callback device 1 to the network connection success status and then sends the network connection success status to the application 40. It can be understood that the network connection success status can be sent directly to the application 40, or it can be sent to the application 40 together with the domain name service status obtained; this is not limited here.
[0038] Furthermore, the service control component 20 sends a request to the service configuration module 31 to update the domain name service information. The service configuration module 31 updates the domain name service information in the message callback device 1 based on the received request. Optionally, the service configuration module 31 may first verify whether the domain name service information in the request is valid, and only update the domain name service information if the verification is valid.
[0039] The service configuration module 31 sets the updated domain name service information into the domain name service module 32, and then configures the domain name service module 32 to connect with the domain name server 02 corresponding to the domain name service information, thereby obtaining the domain name resolution service provided by the domain name server 02. The service configuration module 31 can also send a domain name service configuration progress notification message to the service control component 20, causing the service control component 20 to update the domain name service status of the callback device 1 based on the received configuration progress message, and send the currently updated domain name service status to the application 40.
[0040] Application 40 performs web page access control based on the received network connection status and domain name service status. For example, when the network connection status is "network connection successful" and the domain name service status is "allow to initiate", it sends a web page access request to the domain name service module 32.
[0041] The domain name service module 32 receives the web page access request sent by the application 40, then generates a domain name resolution request based on the domain name address carried in the web page access request, and then sends the domain name resolution request to the domain name server 02.
[0042] Domain name server 02 performs domain name resolution based on the received domain name resolution request, obtains the IP address corresponding to the domain name address, and returns the value to domain name service module 32. Domain name service module 32 then sends the received IP address to application 40.
[0043] The following will combine Figures 2-5 This application provides a detailed description of the message callback method provided in the embodiments.
[0044] Please see Figure 2 The diagram below illustrates a message callback method provided in this application. Figure 2As shown, the method may include the following steps S101-S104.
[0045] S101, If a network connection is established with a data network device, the network connection status of the network connection is set to a network connection success status.
[0046] In one implementation, network connection refers to the communication link between the data network device and the message callback device; network connection status indicates whether a communication link exists between the data network device and the message callback device, which can be understood as having communication capability; further, network connection success status indicates that a communication link exists between the data network device and the message callback device.
[0047] The message callback device first checks whether there is a network connection between the message callback device and the data network device, and if there is a network connection between the message callback device and the data network device, it sets the network connection status to a successful network connection status.
[0048] S102, receive domain name service information from the domain name server provided by the data network device.
[0049] In one implementation, the domain name service information includes the domain name address of the domain name server and the Internet Protocol address of the domain name server.
[0050] After establishing a network connection with the data network device, the message callback device can request the domain name service information of the domain name server in the network environment corresponding to the data network device from the data network device, and then receive the domain name service information of the domain name server provided by the data network device.
[0051] S103, Configure domain name service based on the domain name service information and determine the domain name service status.
[0052] In one implementation, domain name service refers to the process of generating a domain name resolution request and sending the domain name resolution request to a domain name server to obtain the Internet Protocol address corresponding to the domain name resolution request. It can be understood that the domain name service status is used to indicate whether the message callback device has the capability of the domain name service.
[0053] The message callback mechanism updates the domain name service information configured in the domain name service component to the currently received domain name service information, and then configures the domain name service based on the updated domain name service information. It is understood that the domain name service configuration process includes, but is not limited to, determining the availability of the domain name server, determining the corresponding operating parameters of the domain name server (the operating parameters related to the message callback mechanism when using the domain name service provided by that domain name server), and setting the domain name port, among other domain name service configuration processes.
[0054] The message callback device can also update the domain name service status based on the domain name service configuration process. It is understandable that, in order to avoid frequently obtaining the domain name service status, the message callback device will only re-determine the domain name service status after detecting a change in the domain name service configuration process.
[0055] S104, the network connection success status and the domain name service status are sent to the application; wherein, the network connection success status and the domain name service status are used to indicate the initiation status of the web page access request of the application.
[0056] In one implementation, a webpage access request is a request containing the domain name address of the webpage to be accessed. This can be understood as an access request sent by the application to the domain name resolution component. The domain name resolution component generates a domain name resolution request based on the received webpage access request and sends it to the domain name server corresponding to the domain name resolution component, in order to obtain the Internet Protocol address corresponding to the webpage's domain name address from the domain name server.
[0057] When the message callback device obtains a successful network connection status, it can send the successful network connection status to the application. At the same time, when it obtains the domain name service status, it will also send the domain name service status to the application.
[0058] It is understandable that the message callback device can also integrate the network connection success status and domain name service status into a single callback message, and then send this callback message to the application. This embodiment does not limit the method of sending the network connection success status and domain name service status.
[0059] It should be noted that an application can only generate and initiate a web page access request when the network connection status is "network connection successful" and the domain name service status indicates that the domain name service is available.
[0060] In this embodiment, if the message callback device has already established a network connection with the data network device, the network connection status of the network connection is set to a successful network connection status. Then, based on the network connection, the domain name service information of the domain name server provided by the data network device is obtained. Based on the domain name service information, the domain name service of the message callback device is configured. Then, the domain name service status is determined according to the configuration process of the domain name service. Finally, the successful network connection status and the domain name service status are sent to the application. This ensures that the application will only send the web page access request to the domain name resolution component when both the network service and the domain name service of the message callback device are ready. In the case that the domain name service is not ready, the frequent generation and sending of web page access requests and execution of the domain name resolution process are avoided, but the Internet Protocol corresponding to the domain name address cannot be obtained. This reduces the system resource consumption rate by reducing unnecessary system running processes.
[0061] Understandably, because the initiation status of webpage access requests differs depending on the network connection status and domain name service status, different status messages need to be called back to accurately reduce system resource consumption while ensuring normal webpage access. The following will combine... Figures 3-5 This section provides a detailed introduction to the message callback methods corresponding to different states.
[0062] Please see Figure 3 The diagram below illustrates a message callback method provided in this application. Figure 3 As shown, the method may include the following steps S201-S209.
[0063] S201, In response to the registration request for the message callback interface sent by the application, a message callback interface is established with the application.
[0064] In one implementation, the message callback interface serves as a channel for the service control component to send messages (i.e., network connectivity status and domain name service status) to the application. Optionally, the registration request for the message callback interface may include a callback object, a callback function, and callback parameters, wherein at least one callback parameter is included. For example, if the callback parameters are network connectivity status and domain name service status, it can be understood that the message callback interface is used to send back the network connectivity status and domain name service status to the application, and the callback object is the application that sent the registration request.
[0065] The service control component of the message callback mechanism receives a registration request for the message callback interface sent by the application. Based on the registration message carried in the registration request, it then creates a callback function within the service control component to send callback parameters to the callback object. For example, a callback function is created within the service control component to send network connection status and domain name service status to the application.
[0066] S202, in response to a network connection command, obtains network service information from the data network device.
[0067] In one implementation, the network connection command refers to the control command used by the control message callback device to establish a network connection with the data network equipment. Network service information refers to the attribute information of the data network equipment, such as network type and communication address.
[0068] When the message callback device reconnects to the data network device or switches to the corresponding data network device, it generates a network connection command and then responds to the network connection command to obtain the network service information of the data network device in the environment where the message callback device is located.
[0069] It should be noted that when the message callback device reconnects to the data network device or switches to a different data network device, the message callback device will always be in a disconnected network state. For example, when the message callback device is in a disconnected network state, it generates a network connection command to reconnect to the data network device. Even if a network connection exists between the message callback device and the current data network device, when it receives a control command to switch data network devices, it first disconnects the network connection with the current data network device and then establishes a network connection with the new data network device.
[0070] S203, establish a network connection with the data network device based on the network service information.
[0071] In one implementation, a network connection refers to the communication link between the data network device and the message callback device. The message callback device sends a network connection request to the data network device corresponding to the network service information. The data network device verifies the message callback device based on the network connection request and, upon successful verification, sends a network connection response to the message callback device. The message callback device and the data network device establish a network connection based on the network connection response and the network connection request, respectively.
[0072] In this embodiment of the application, a network connection is established with a data network device to provide communication conditions for interactive data for web page access of the application, thereby realizing the web page access process of the application.
[0073] S204, If a network connection is established with a data network device, the network connection status of the network connection is set to a successful network connection status.
[0074] In one implementation, the network connection status indicates whether a communication link exists between the data network device and the message callback device, which means that the communication link is capable of communication; further, the network connection success status indicates that a communication link exists between the data network device and the message callback device.
[0075] The message callback device obtains the connection progress of the network connection process. When the connection progress is "connection complete", it determines that there is a network connection between the message callback device and the data network device, and sets the network connection status to "network connection successful".
[0076] S205, receive domain name service information from the domain name server provided by the data network device.
[0077] In one implementation, the domain name service information includes the domain name address of the domain name server and the Internet Protocol address of the domain name server.
[0078] After establishing a network connection with the data network device, the message callback device can request the domain name service information of the domain name server in the network environment corresponding to the data network device from the data network device, and then receive the domain name service information of the domain name server provided by the data network device.
[0079] S206, Configure domain name services based on the domain name service information and determine the domain name service status.
[0080] In one implementation, domain name service refers to the process of generating a domain name resolution request and sending the domain name resolution request to a domain name server to obtain the Internet Protocol address corresponding to the domain name resolution request. It can be understood that the domain name service status is used to indicate whether the message callback device has the capability of the domain name service.
[0081] The message callback mechanism updates the domain name service information configured in the domain name service component to the currently received domain name service information, and then configures the domain name service based on the updated domain name service information. It is understood that the domain name service configuration process includes, but is not limited to, determining the availability of the domain name server, determining the corresponding operating parameters of the domain name server (the operating parameters related to the message callback mechanism when using the domain name service provided by that domain name server), and setting the domain name port, among other domain name service configuration processes.
[0082] The message callback device can also update the domain name service status based on the domain name service configuration process. It is understandable that, in order to avoid frequently obtaining the domain name service status, the message callback device will only re-determine the domain name service status after detecting a change in the domain name service configuration process.
[0083] In one implementation, determining the domain name service status includes the following steps:
[0084] If the domain name service is in the configuration process, then the domain name service status configured for the domain name service is set to the domain name service configuration status;
[0085] The network connection success status and the domain name service configuration status are used to indicate that the application's web page access request has been stopped.
[0086] The message callback mechanism obtains the configuration progress of the domain name service. If the domain name service is still in the configuration process, it sets the domain name service status to the "domain name service configuration state". It's understandable that the message callback mechanism cannot provide domain name services to the application while the domain name service status is in the "domain name service configuration state".
[0087] In this embodiment, the configuration progress of the domain name service configuration process is obtained to determine the domain name service status. The application will only send the web page access request to the domain name resolution component when the network connection of the message callback device is successful and the domain name service is started. In the case that the domain name service is not ready, the frequent generation and sending of web page access requests and execution of the domain name resolution process are avoided, but the Internet Protocol corresponding to the domain name address cannot be obtained. The system resource consumption rate is reduced by reducing unnecessary system running processes.
[0088] In one implementation, determining the domain name service status includes the following steps:
[0089] If the domain name service is in a closed state, then the domain name service status configured in the domain name service will be set to the closed state.
[0090] The network connection success status and the domain name service shutdown status are used to indicate that the application's web page access request has stopped being initiated.
[0091] The message callback mechanism obtains the configuration progress of the domain name service configuration process. If the domain name service is in a closed state, meaning that the domain name service configuration has not started, then the domain name service status is set to closed. It is understandable that when the domain name service status is closed, the message callback mechanism cannot provide domain name services to the application.
[0092] In this embodiment, the configuration progress of the domain name service configuration process is obtained to determine the domain name service status. The application will only send the web page access request to the domain name resolution component when the network connection of the message callback device is successful and the domain name service is started. In the case that the domain name service is not ready, the frequent generation and sending of web page access requests and execution of the domain name resolution process are avoided, but the Internet Protocol corresponding to the domain name address cannot be obtained. The system resource consumption rate is reduced by reducing unnecessary system running processes.
[0093] In one implementation, determining the domain name service status includes the following steps:
[0094] If the domain name service is configured successfully, the domain name service status configured in the domain name service will be set to the domain name service start status;
[0095] The network connection success status and the domain name service startup status are used to indicate that the application's web page access request is in the allowed state.
[0096] The message callback mechanism obtains the configuration progress of the domain name service configuration process. If the domain name service is in the "started" state, meaning the domain name service configuration is complete, it sets the domain name service status to "started". It can be understood that when the domain name service status is "started" and the network connection status is "network connection successful", the message callback mechanism can provide the domain name service to the application.
[0097] In this embodiment of the application, the configuration progress of the domain name service configuration process is obtained to determine the domain name service status. When the network connection of the message callback device is successful and the domain name service is started, the application can send a web page access request to the domain name resolution component, thereby executing the domain name resolution process and obtaining the Internet Protocol status corresponding to the domain name address. This reduces the system resource consumption rate by reducing unnecessary system running processes.
[0098] S207, using a message callback interface, the network connection success status and the domain name service status are sent to the application, wherein the network connection success status and the domain name service status are used to indicate the initiation status of the application's web page access request.
[0099] In one implementation, a webpage access request is a request containing the domain name address of the webpage to be accessed. This can be understood as an access request sent by the application to the domain name resolution component. The domain name resolution component generates a domain name resolution request based on the received webpage access request and sends it to the domain name server corresponding to the domain name resolution component, in order to obtain the Internet Protocol address corresponding to the webpage's domain name address from the domain name server.
[0100] The message callback mechanism combines the network connection success status and the domain name service status into a single callback message, which is then sent to the application via the message callback interface.
[0101] Understandably, the message callback device sends the network connection status and domain name service status to the application through the message callback interface each time it obtains the domain name service status.
[0102] Optionally, after obtaining the domain name service status, the message callback device determines whether the domain name service status has changed, and after determining that the domain name service status has changed, sends the changed domain name service status to the application through the message callback interface.
[0103] Similarly, after obtaining the network connection status, the message callback device determines whether the network connection status has changed. If it determines that the network connection status has changed, it sends the changed network connection status to the application through the message callback interface.
[0104] For example, in one application scenario, the message callback device first registers a message callback interface, and then obtains the network connection status between the message callback device and the data network device. When the network connection status is "network connection disconnected," it sends a "network connection disconnected" status message to the application through the message callback interface. When the network connection status is "network connection successful," it first obtains the domain name service information of the domain name server, configures the domain name service based on the domain name service message, then obtains the domain name service status, and finally sends the "network connection successful" status and the domain name service status message to the application through the message callback interface.
[0105] For example, in another application scenario, the message callback device first registers a message callback interface, then obtains the network connection status between the message callback device and the data network device, and then sends the network connection status to the application through the message callback interface. When the network connection status is successful, it obtains the domain name service information of the domain name server, configures the domain name service based on the domain name service message, then obtains the domain name service status, and finally sends the domain name service status to the application through the message callback interface.
[0106] In this embodiment, by establishing a callback interface with the application, the latest status is promptly fed back to the application after the network connection status and domain name service status are updated. This allows the application to adjust the webpage access process in a timely manner based on the received status, avoiding the generation of useless webpage access requests and reducing the consumption rate of system resources. At the same time, by registering message callback interfaces for various message types, the utilization rate of message callback interfaces is improved.
[0107] S208, Receive a webpage access request and send the domain name address in the webpage access request to the domain name server.
[0108] In one implementation, the domain name resolution component of the message callback device receives a web page access request sent by the application, then obtains the domain name address in the web page access request, generates a domain name resolution request based on the domain name address, and then sends the domain name resolution request to the domain name server corresponding to the domain name resolution component.
[0109] After receiving a domain name resolution request, the domain name server performs domain name resolution based on the domain name address in the request, obtains the Internet Protocol address corresponding to the domain name address, and returns the resolved Internet Protocol address to the domain name resolution component.
[0110] S209, Receive the Internet Protocol address returned by the domain name server, and send the Internet Protocol address to the application.
[0111] In one implementation, the domain name resolution component in the message callback device receives the Internet Protocol address returned by the domain name server, and then sends the received Internet Protocol address to the application, so that the application generates a web page access data packet based on the received Internet Protocol address, and sends it to the web server corresponding to the web page access data packet through the network connection component.
[0112] In this embodiment of the application, by generating a domain name resolution request and sending it to the domain name server, the Internet Protocol address obtained by the domain name server based on the domain name address is obtained, thereby achieving the domain name resolution purpose of the application.
[0113] Please see Figure 4 The diagram below illustrates a message callback method provided in this application. Figure 4 As shown, the method may include the following steps S301-S309.
[0114] S301, in response to the registration request for the network message callback interface sent by the application, establish a network message callback interface with the application.
[0115] In one implementation, the network message callback interface serves as a channel for the service control component to send feedback on network connection status to the application. Optionally, the registration request for the network message callback interface may include a callback object, a callback function, and callback parameters, where the callback parameters represent the network connection status. The network message callback interface is used to send feedback on the network connection status to the application, and in this case, the callback object is the application that sent the registration request.
[0116] The service control component of the message callback device receives a registration request for the network message callback interface sent by the application. Based on the registration message carried in the registration request, it then establishes a callback function in the service control component to send callback parameters to the callback object. For example, a callback function is established in the service control component to send network connection status to the application.
[0117] S302, in response to the registration request for the domain name message callback interface sent by the application, establish a domain name message callback interface with the application.
[0118] In one implementation, the domain message callback interface serves as a channel for the service control component to send feedback on the domain service status to the application. Optionally, the domain message callback interface is used to send feedback on the domain service status to the application, where the callback target is the application that sent the registration request.
[0119] The service control component of the message callback mechanism receives a registration request for the domain name message callback interface sent by the application. Based on the registration message carried in the registration request, it then establishes a callback function in the service control component to send callback parameters to the callback object. For example, a callback function is established in the service control component to send the domain name service status to the application.
[0120] S303, if the network connection with the data network device is disconnected, the network connection status of the network connection is set to the network connection disconnected state.
[0121] In one implementation, network connection refers to the communication link between the data network device and the message callback device; network connection status indicates whether a communication link exists between the data network device and the message callback device, which can be understood as having communication capability; further, network connection success status indicates that a communication link exists between the data network device and the message callback device.
[0122] The message callback device first checks whether there is a network connection between the message callback device and the data network device, and if there is no network connection between the message callback device and the data network device, it sets the network connection status to the disconnected state.
[0123] S304, using a network message callback interface, the network connection disconnection status is sent to the application, wherein the network connection disconnection status is used to indicate that the application's web page access request has stopped being initiated.
[0124] In one implementation, when the message callback device determines that the network connection status is disconnected, it sends the network connection disconnected status to the application through the network message callback interface.
[0125] When the application is in a network connection disconnected state, it determines that the message callback device cannot provide data network services and cannot perform data interaction, thus stopping the generation of web page access requests.
[0126] In this embodiment of the application, by obtaining the network connection status, the application will only send the web page access request to the domain name resolution component when the network connection of the message callback device is successful and the domain name service is started. In the case that the data network service is not ready, the frequent generation and sending of web page access requests and execution of the domain name resolution process are avoided, but the Internet Protocol corresponding to the domain name address cannot be obtained. The system resource consumption rate is reduced by reducing unnecessary system running processes.
[0127] S305, if a network connection is established with a data network device, the network connection status of the network connection is set to a network connection successful status.
[0128] In one implementation, the network connection status indicates whether a communication link exists between the data network device and the message callback device, which means that the communication link is capable of communication; further, the network connection success status indicates that a communication link exists between the data network device and the message callback device.
[0129] The message callback device obtains the connection progress of the network connection process. When the connection progress is "connection complete", it determines that there is a network connection between the message callback device and the data network device, and sets the network connection status to "network connection successful".
[0130] S306, Receive domain name service information from the domain name server provided by the data network device.
[0131] In one implementation, the domain name service information includes the domain name address of the domain name server and the Internet Protocol address of the domain name server.
[0132] After establishing a network connection with the data network device, the message callback device can request the domain name service information of the domain name server in the network environment corresponding to the data network device from the data network device, and then receive the domain name service information of the domain name server provided by the data network device.
[0133] S307, Configure domain name service based on the domain name service information and determine the domain name service status.
[0134] In one implementation, domain name service refers to the process of generating a domain name resolution request and sending the domain name resolution request to a domain name server to obtain the Internet Protocol address corresponding to the domain name resolution request. It can be understood that the domain name service status is used to indicate whether the message callback device has the capability of the domain name service.
[0135] The message callback mechanism updates the domain name service information configured in the domain name service component to the currently received domain name service information, and then configures the domain name service based on the updated domain name service information. It is understood that the domain name service configuration process includes, but is not limited to, determining the availability of the domain name server, determining the corresponding operating parameters of the domain name server (the operating parameters related to the message callback mechanism when using the domain name service provided by that domain name server), and setting the domain name port, among other domain name service configuration processes.
[0136] The message callback device can also update the domain name service status based on the domain name service configuration process. It is understandable that, in order to avoid frequently obtaining the domain name service status, the message callback device will only re-determine the domain name service status after detecting a change in the domain name service configuration process.
[0137] S308 uses a network message callback interface to send the network connection success status to the application.
[0138] In one implementation, the message callback mechanism sends the network connection success status to the application via a network message callback interface. It can be understood that the message callback mechanism sends the network connection status to the application via the network message callback interface each time it obtains the network connection status.
[0139] Optionally, after obtaining the network connection status, the message callback device determines whether the network connection status has changed, and after determining that the network connection status has changed, sends the changed network connection status to the application through the network message callback interface.
[0140] S309, using a domain name message callback interface, the domain name service status is sent to the application; wherein, the network connection success status and the domain name service status are used to indicate the initiation status of the application's web page access request.
[0141] In one implementation, a webpage access request is a request containing the domain name address of the webpage to be accessed. This can be understood as an access request sent by the application to the domain name resolution component. The domain name resolution component generates a domain name resolution request based on the received webpage access request and sends it to the domain name server corresponding to the domain name resolution component, in order to obtain the Internet Protocol address corresponding to the webpage's domain name address from the domain name server.
[0142] The message callback mechanism sends the domain service status to the application through the domain message callback interface. It can be understood that the message callback mechanism sends the domain service status to the application through the domain message callback interface each time it receives it.
[0143] Optionally, after obtaining the domain name service status, the message callback device determines whether the domain name service status has changed, and after determining that the domain name service status has changed, sends the changed domain name service status to the application through the domain name message callback interface.
[0144] For example, in one application scenario, after registering a network message callback interface, the message callback device obtains the network connection status between itself and the data network device. Upon obtaining the network connection status, it sends this status to the application through the network message callback interface. During this process, the message callback device can also simultaneously register a domain name message callback interface. When the network connection is successful, the message callback device obtains the domain name service information of the domain name server, configures the domain name service based on the domain name service message, then obtains the domain name service status and sends it to the application through the domain name message callback interface.
[0145] In this embodiment of the application, by establishing a callback interface with the application, the latest status is promptly fed back to the application after the network connection status and domain name service status are updated. This allows the application to adjust the webpage access process in a timely manner based on the received status, avoiding the generation of useless webpage access requests and reducing the consumption rate of system resources.
[0146] Please see Figure 5 The diagram below illustrates a message callback method provided in this application. Figure 5 As shown, the method may include the following steps S1-S10.
[0147] S1, register message callback interface.
[0148] The message callback device registers a message callback interface and then executes S2.
[0149] This message callback interface is used to send network connection status and domain name service status to the application. Optionally, the message callback interface may also include a network message callback interface and a domain name message callback interface, wherein the network message callback interface is used to send network connection status to the application, and the domain name message callback interface is used to send domain name service status to the application.
[0150] S2, Get network connection status.
[0151] The message callback device obtains the network connection status between itself and the data network device. If the network connection status is "network connection disconnected", then execute S3; if the network connection status is "network connection successful", then execute S6.
[0152] S3 indicates that the network connection is disconnected.
[0153] The message callback device sends a network connection disconnection status through the message callback interface or the network message callback interface, and executes S4.
[0154] S4, obtain network service information.
[0155] The message callback device obtains the network service information of the corresponding data network device and executes S5.
[0156] S5, establish network connection.
[0157] The message callback device establishes a network connection between itself and the data network device based on the network service information of the data network device, and then returns to execute S2.
[0158] S6, Send network connection successful status.
[0159] The message callback device sends a network connection success status through the message callback interface or the network message callback interface, and executes S7.
[0160] S7, retrieve domain name service information.
[0161] The message callback device obtains the domain name service information of the domain name server through the network connection with the data network equipment and executes S8.
[0162] S8, configure domain name service.
[0163] The message callback device updates the domain name service information in the domain name resolution component based on the domain name service information of the domain name server, and then performs domain name service configuration based on the updated domain name service information, and executes S9.
[0164] S9, retrieve the domain name service status.
[0165] The message callback device obtains the domain name service status based on the domain name service configuration and executes S10.
[0166] S10, Send domain name service status.
[0167] The message callback device sends the domain name service status through the message callback interface or the domain name message callback interface, and periodically returns to execute S9 until the network connection status of the message callback device switches to the network connection disconnected state, or the message callback device stops providing domain name resolution services.
[0168] Optionally, the currently obtained domain service status can be sent only when the domain service status changes.
[0169] The following will be combined with the appendix Figure 6 - Appendix Figure 7 This application provides a detailed description of the message callback device provided in its embodiments. It should be noted that the appendix... Figure 6 - Appendix Figure 7 Message callback mechanism, used to execute this application Figures 1-5 The methods shown in the embodiments are for illustrative purposes only, illustrating the parts relevant to the embodiments of this application. For specific technical details not disclosed, please refer to this application. Figures 1-5 The example shown.
[0170] Please see Figure 6 The diagram below illustrates the structure of a message callback device as provided in this application embodiment. Figure 6 As shown, the message callback device 2 in this embodiment may include: a network determination module 11, an information receiving module 12, a domain name configuration module 13, and a status indication module 14.
[0171] The network determination module 11 is used to set the network connection status of the network connection to a network connection success status if a network connection is established with a data network device.
[0172] Information receiving module 12 is used to receive domain name service information from the domain name server provided by the data network device;
[0173] Domain name configuration module 13 is used to configure domain name services based on the domain name service information and determine the domain name service status;
[0174] The status indication module 14 is used to send the network connection success status and the domain name service status to the application; wherein the network connection success status and the domain name service status are used to indicate the initiation status of the web page access request of the application.
[0175] In this embodiment, if the message callback device has already established a network connection with the data network device, the network connection status of the network connection is set to a successful network connection status. Then, based on the network connection, the domain name service information of the domain name server provided by the data network device is obtained. Based on the domain name service information, the domain name service of the message callback device is configured. Then, the domain name service status is determined according to the configuration process of the domain name service. Finally, the successful network connection status and the domain name service status are sent to the application. This ensures that the application will only send the web page access request to the domain name resolution component when both the network service and the domain name service of the message callback device are ready. In the case that the domain name service is not ready, the frequent generation and sending of web page access requests and execution of the domain name resolution process are avoided, but the Internet Protocol corresponding to the domain name address cannot be obtained. This reduces the system resource consumption rate by reducing unnecessary system running processes.
[0176] Optional, please refer to Figure 7 The message callback device 2 also includes a network connection module 15.
[0177] Network connection module 15 is specifically used for:
[0178] In response to network connection commands, obtain network service information of data network devices;
[0179] A network connection is established with the data network device based on the network service information.
[0180] Optional, please refer to Figure 7 The message callback device 2 also includes: interface registration module 16.
[0181] The interface registration module 16 is specifically used for:
[0182] In response to a registration request for a message callback interface sent by an application, a message callback interface is established with the application.
[0183] The status indication module 14 is specifically used for:
[0184] The network connection success status and the domain name service status are sent to the application using a message callback interface.
[0185] Optionally, the interface registration module 16 is specifically used for:
[0186] In response to a registration request from the application for a network message callback interface, a network message callback interface is established with the application.
[0187] In response to a registration request from the application for a domain message callback interface, a domain message callback interface is established between the application and the application.
[0188] The status indication module 14 is specifically used for:
[0189] The network connection success status is sent to the application using a network message callback interface;
[0190] The domain name service status is sent to the application using a domain name message callback interface.
[0191] Optionally, the domain name configuration module 13 is specifically used for:
[0192] If the domain name service is in the configuration process, then the domain name service status configured for the domain name service is set to the domain name service configuration status;
[0193] The network connection success status and the domain name service configuration status are used to indicate that the application's web page access request has been stopped.
[0194] Optionally, the domain name configuration module 13 is specifically used for:
[0195] If the domain name service is in a closed state, then the domain name service status configured in the domain name service will be set to the closed state.
[0196] The network connection success status and the domain name service shutdown status are used to indicate that the application's web page access request has stopped being initiated.
[0197] Optionally, the domain name configuration module 13 is specifically used for:
[0198] If the domain name service is configured successfully, the domain name service status configured in the domain name service will be set to the domain name service start status;
[0199] The network connection success status and the domain name service startup status are used to indicate that the application's web page access request is in the allowed state.
[0200] Optional, please refer to Figure 7 The message callback device 2 also includes a disconnection control module 17.
[0201] The disconnect control module 17 is specifically used for:
[0202] If the network connection with the data network device is lost, the network connection status of the network connection is set to the network connection lost state.
[0203] The network connection disconnected status is sent to the application, wherein the network connection disconnected status is used to indicate that the application's web page access request has stopped being initiated.
[0204] Optional, please refer to Figure 7 The message callback device 2 also includes: domain name resolution module 18.
[0205] Domain name resolution module 18 is specifically used for:
[0206] Receive a webpage access request and send the domain name address in the webpage access request to the domain name server;
[0207] Receive the Internet Protocol address returned by the domain name server and send the Internet Protocol address to the application.
[0208] This application embodiment also provides a storage medium that can store multiple program instructions, which are adapted to be loaded and executed by a processor as described above. Figures 1-6 The method steps of the illustrated embodiment can be found in the following documentation for detailed execution. Figures 1-6 The specific details of the illustrated embodiments will not be elaborated here.
[0209] Please see Figure 8 This document provides a schematic diagram of the structure of a computer device according to an embodiment of this application. Figure 8As shown, the computer device 1000 may include: at least one processor 1001, at least one communication bus 1002, at least one input / output interface 1003, at least one network interface 1004, and at least one memory 1005. The processor 1001 may include one or more processing cores. The processor 1001 connects various parts within the computer device 1000 using various interfaces and lines, and performs various functions of the terminal 1000 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and by calling data stored in the memory 1005. The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the processor 1001. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The communication bus 1002 is used to implement communication between these components. Figure 8 As shown, the memory 1005, which serves as a storage medium for a terminal device, may include an operating system, a network communication module, an input / output interface module, and a message callback program.
[0210] exist Figure 8 In the computer device 1000 shown, the input / output interface 1003 is mainly used to provide an input interface for users and access devices to obtain data input by users and access devices.
[0211] In one embodiment.
[0212] The processor 1001 can be used to call the message callback program stored in the memory 1005 and specifically perform the following operations:
[0213] If a network connection is established with a data network device, the network connection status of the network connection is set to a network connection successful status;
[0214] Receive domain name service information from the domain name server provided by the data network device;
[0215] Configure domain name services based on the domain name service information and determine the domain name service status;
[0216] Send the network connection success status and the domain name service status to the application;
[0217] The network connection success status and the domain name service status are used to indicate the initiation status of the application's web page access request.
[0218] Optionally, before executing the step of setting the network connection status of the network connection to a successful network connection state if a network connection is established with the data network device, the processor 1001 further performs the following operations:
[0219] In response to network connection commands, obtain network service information of data network devices;
[0220] A network connection is established with the data network device based on the network service information.
[0221] Optionally, before executing the step of setting the network connection status of the network connection to a successful network connection state if a network connection is established with the data network device, the processor 1001 further performs the following operations:
[0222] In response to a registration request for a message callback interface sent by an application, a message callback interface is established with the application.
[0223] When sending the network connection success status and the domain name service status to the application, the following operations are performed:
[0224] The network connection success status and the domain name service status are sent to the application using a message callback interface.
[0225] Optionally, before executing the step of setting the network connection status of the network connection to a successful network connection state if a network connection is established with the data network device, the processor 1001 further performs the following operations:
[0226] In response to a registration request from the application for a network message callback interface, a network message callback interface is established with the application.
[0227] In response to a registration request from the application for a domain message callback interface, a domain message callback interface is established between the application and the application.
[0228] When sending the network connection success status and the domain name service status to the application, the following operations are performed:
[0229] The network connection success status is sent to the application using a network message callback interface;
[0230] The domain name service status is sent to the application using a domain name message callback interface.
[0231] Optionally, when the processor 1001 performs the determination of the domain name service status, it specifically performs the following operations:
[0232] If the domain name service is in the configuration process, then the domain name service status configured for the domain name service is set to the domain name service configuration status;
[0233] The network connection success status and the domain name service configuration status are used to indicate that the application's web page access request has been stopped.
[0234] Optionally, when the processor 1001 performs the determination of the domain name service status, it specifically performs the following operations:
[0235] If the domain name service is in a closed state, then the domain name service status configured in the domain name service will be set to the closed state.
[0236] The network connection success status and the domain name service shutdown status are used to indicate that the application's web page access request has stopped being initiated.
[0237] Optionally, when the processor 1001 performs the determination of the domain name service status, it specifically performs the following operations:
[0238] If the domain name service is configured successfully, the domain name service status configured in the domain name service will be set to the domain name service start status;
[0239] The network connection success status and the domain name service startup status are used to indicate that the application's web page access request is in the allowed state.
[0240] Optionally, the processor 1001 can also be used to call the message callback program stored in the memory 1005, and specifically perform the following operations:
[0241] If the network connection with the data network device is lost, the network connection status of the network connection is set to the network connection lost state.
[0242] The network connection disconnected status is sent to the application, wherein the network connection disconnected status is used to indicate that the application's web page access request has stopped being initiated.
[0243] Optionally, after sending the network connection success status and the domain name service status to the application, the processor 1001 further performs the following operations:
[0244] Receive a webpage access request and send the domain name address in the webpage access request to the domain name server;
[0245] Receive the Internet Protocol address returned by the domain name server and send the Internet Protocol address to the application.
[0246] In this embodiment, if the message callback device has already established a network connection with the data network device, the network connection status of the network connection is set to a successful network connection status. Then, based on the network connection, the domain name service information of the domain name server provided by the data network device is obtained. Based on the domain name service information, the domain name service of the message callback device is configured. Then, the domain name service status is determined according to the configuration process of the domain name service. Finally, the successful network connection status and the domain name service status are sent to the application. This ensures that the application will only send the web page access request to the domain name resolution component when both the network service and the domain name service of the message callback device are ready. In the case that the domain name service is not ready, the frequent generation and sending of web page access requests and execution of the domain name resolution process are avoided, but the Internet Protocol corresponding to the domain name address cannot be obtained. This reduces the system resource consumption rate by reducing unnecessary system running processes.
[0247] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0248] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0249] The above is a description of a message callback method, apparatus, storage medium and device provided in this application. For those skilled in the art, based on the ideas of the embodiments of this application, there will be changes in the specific implementation and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A message callback method, characterized in that: The method comprises: If a network connection is established with the data network device, setting the network connection state of the network connection to a network connection success state; Receiving domain name service information of a domain name server provided by the data network device; Configure a domain name service based on the domain name service information, and determine a domain name service status according to a configuration process of the domain name service; Sending the network connection success status and the domain name service status to the application; The network connection success status and the domain name service status are used to indicate the initiation status of the web page access request of the application.
2. The method according to claim 1, characterized in that If a network connection is established with the data network device, before the network connection state of the network connection is set to a network connection success state, the method further includes: In response to the network connection instruction, acquiring network service information of the data network device; A network connection is established with the data network device based on the network service information.
3. The method according to claim 1, characterized in that If a network connection is established with the data network device, before the network connection state of the network connection is set to a network connection success state, the method further includes: In response to a registration request for a message callback interface sent by an application, establishing a message callback interface with the application; The sending the network connection success status and the domain name service status to the application includes: The message callback interface is used to send the network connection success status and the domain name service status to the application.
4. The method according to claim 1, characterized in that: If a network connection is established with the data network device, before the network connection state of the network connection is set to a network connection success state, the method further includes: In response to a registration request for a network message callback interface sent by an application, establishing a network message callback interface with the application; In response to a registration request for a domain name message callback interface sent by an application, establishing a domain name message callback interface with the application; The sending the network connection success status and the domain name service status to the application includes: Using a network message callback interface, the network connection success status is sent to the application; The domain name service status is sent to the application using a domain name message callback interface.
5. The method according to claim 1, characterized in that The determining the domain name service state according to the configuration process of the domain name service includes: If the domain name service is in the process of being configured, setting the domain name service state of the domain name service configuration to the domain name service configuration state; The network connection success status and the domain name service configuration status are used to indicate that the initiation status of the web page access request of the application is a stop initiation status.
6. The method according to claim 1, characterized in that The determining the domain name service state according to the configuration process of the domain name service includes: If the domain name service is in a closed state, setting the domain name service state of the domain name service configuration to a domain name service closed state; The network connection success status and the domain name service shutdown status are used to indicate that the initiation status of the web page access request of the application is a stop initiation status.
7. The method according to claim 1, characterized in that The determining the domain name service state according to the configuration process of the domain name service includes: If the domain name service configuration is successful, setting the domain name service status of the domain name service configuration to the domain name service startup status; The network connection success status and the domain name service startup status are used to indicate that the initiation status of the web page access request of the application is the initiation permission status.
8. The method according to claim 7, characterized in that After sending the network connection success status and the domain name service status to the application, the method further includes: Receive a web page access request, and send the domain name address in the web page access request to the domain name server; Receive the Internet Protocol address returned by the domain name server, and send the Internet Protocol address to the application.
9. The method according to claim 1, characterized in that: The method further comprises: If the network connection with the data network device is disconnected, setting the network connection state of the network connection to a network connection disconnected state; The network connection disconnection status is sent to an application program, wherein the network connection disconnection status is used to indicate that the initiation status of the webpage access request of the application program is a stop initiation status.
10. A message callback device, characterized in that: include: A network determination module, configured to set the network connection state of the network connection to a network connection success state if a network connection is established with a data network device; An information receiving module, used for receiving domain name service information of a domain name server provided by the data network device; A domain name configuration module, configured to configure a domain name service based on the domain name service information, and determine a domain name service status according to a configuration process of the domain name service; A status indication module is used to send the network connection success status and the domain name service status to the application; wherein the network connection success status and the domain name service status are used to indicate the initiation status of the web page access request of the application.
11. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the message callback method according to any one of claims 1 to 9 is implemented.
12. A computer device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the message callback method as described in any one of claims 1-9.
