CN114363204A - Request monitoring method, network device and storage medium - Google Patents

Request monitoring method, network device and storage medium Download PDF

Info

Publication number
CN114363204A
CN114363204A CN202111498465.0A CN202111498465A CN114363204A CN 114363204 A CN114363204 A CN 114363204A CN 202111498465 A CN202111498465 A CN 202111498465A CN 114363204 A CN114363204 A CN 114363204A
Authority
CN
China
Prior art keywords
connection
time
called
request
monitoring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111498465.0A
Other languages
Chinese (zh)
Inventor
郑秀群
梁少泽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wangsu Science and Technology Co Ltd
Original Assignee
Wangsu Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN202111498465.0A priority Critical patent/CN114363204A/en
Publication of CN114363204A publication Critical patent/CN114363204A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention relates to the technical field of Internet, and discloses a request monitoring method, which comprises the following steps: respectively burying point monitoring methods in each method called by establishing a WebSocket connection at an iOS terminal, wherein the monitoring methods are used for hosting the called method; and when the iOS terminal initiates the WebSocket connection, acquiring index data in the WebSocket connection process according to the hosting time of the monitoring method on the hosted method. The embodiment of the invention also discloses a network device and a storage medium. The request monitoring method, the network device and the storage medium provided by the embodiment of the invention can acquire index data for analyzing information such as the speed of WebSocket connection, the speed of loading, whether the connection is successful and the like, thereby effectively improving the WebSocket connection.

Description

Request monitoring method, network device and storage medium
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a request monitoring method, a network device, and a storage medium.
Background
SRWebSocket is open by Facebook to establish a framework for WebSocket connections in iOS. At present, a lot of businesses need to use a WebSocket protocol, and an iOS end uses a SocketRecket framework to initiate a WebSocket request. The WebSocket protocol is a two-way simultaneous communication protocol, and has a wide application range, and scenes such as social contact, games or cooperative office work need to use the WebSocket protocol.
However, index data in the process of establishing the WebSocket connection cannot be obtained by the existing method, so that the improvement on the WebSocket connection cannot be performed.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a request monitoring method, a network device, and a storage medium, which can obtain index data for analyzing information such as how fast a WebSocket connection is, how fast a WebSocket connection is loaded, and whether the connection is successful, so that effective improvement can be performed on the WebSocket connection.
In order to solve the above technical problem, an embodiment of the present invention provides a request monitoring method, including: respectively burying point monitoring methods in each method called by establishing WebSocket connection at the iOS terminal; the monitoring method is used for hosting the called method; when the iOS terminal initiates the WebSocket connection, index data in the WebSocket connection process are obtained according to the hosting time of the monitoring method to the hosting method.
An embodiment of the present invention further provides a network device, including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the request monitoring method.
Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which when executed by a processor implements the request monitoring method described above.
Compared with the related technology, the embodiment of the invention monitors the connection process according to the monitoring method of the pre-buried point when the iOS terminal initiates the WebSokey connection through the method called by establishing the WebSokey connection at the iOS terminal. The method called by the iOS end for establishing the WebSokect connection is the buried point monitoring method, so that when the iOS end initiates the WebSokect connection, monitoring of the process of establishing the WebSokect connection by the iOS end can be realized according to the buried point monitoring method, the conditions of the speed of establishing the WebSokect connection, the speed of loading and whether the connection is successful or not by the iOS end can be monitored, and targeted measures are improved when the WebSokect connection is established or the WebSokect connection is loaded slowly or the connection is failed.
In addition, the method for monitoring the buried point in the method called by establishing the WebSocket connection at the iOS terminal comprises the following steps: and adding the monitoring method to a method called by the iOS end for establishing the WebSocket connection by using the exchange function. The monitoring method is added to the method called by establishing the WebSokey connection through the exchange function, so that the monitoring method can be embedded in the method called by establishing the WebSokey connection at the iOS end, and traceless embedding of the monitoring method is realized.
In addition, when the iOS initiates the WebSocket connection, according to the hosting time of the monitoring method to the hosting method, index data in the WebSocket connection process is obtained, which includes: when the method with the monitoring method at the embedded point is called at the iOS end to initiate WebSocket connection, the monitoring method is called by using a swap function; and acquiring index data in the WebSocket connection process according to the hosting time of the monitoring method to the hosting method. When the method with the monitoring method at the buried point is called at the iOS terminal to initiate the WebSokey connection, the monitoring method is called by using the preset exchange function, the process of the connection is monitored by using the called monitoring method, and the WebSokey connection established at the iOS terminal can be monitored.
In addition, when each called method comprises an interface calling method before the request starting position, the acquired index data comprises: a point in time at which a connection is requested to start; when each called method comprises a connection completion method, the acquired index data comprises the following steps: a point in time at which the connection is completed; when each called method comprises a method for successfully establishing the connection, the acquired index data comprises the following steps: the time point when the Http request starts to be sent is used for requesting upgrading of the websokcet; when each called method comprises a method for starting to receive response header information, the acquired index data comprises: the sending time of the Http request is the difference between the sending completion time of the Http request and the sending start time of the Http request; when each called method comprises a method for completing receiving response head information, the acquired index data comprises the following steps: a time point at which the response reception is completed, and a response time, wherein the response time is a difference between the time point at which the response reception is completed and a time point at which the response starts to be received. In addition, under the condition that the WebSocket connection is the WSS connection, when each called method comprises a connection completion method, the obtained index data further comprises the following steps: the method comprises the following steps of starting a time point of SSL authentication, and the sum of DNS analysis time and TCP three-way handshake connection time, wherein the sum of the DNS analysis time and the TCP three-way handshake connection time is the difference between a time point of connection completion and a time point of connection starting request; when each called method comprises a method for successfully establishing the connection and the acquired index data, the method also comprises the following steps: the SSL authentication method includes the steps of obtaining a SSL handshake success time point and a SSL handshake time, wherein the SSL handshake time is the difference between the SSL handshake success time point and the SSL authentication start time point. The monitoring method is added to any one or any combination of an interface calling method, a connection completion method, a http request sending connection establishment method, a response header information starting method and a response header information receiving completion method which are called by the iOS terminal to establish the WebSocket connection and are positioned in front of the request starting position, so that various index data in the WebSocket connection process can be acquired.
In addition, in the case where the iOS initiates the WebSocket connection based on the SRWebSocket-master version framework, the method further comprises: and under the condition that the WebSocket connection needs to be established by using the proxy, the flow is transferred to the proxy server, so that the flow transfer is realized, and the speed of the WebSokey connection at the iOS end is accelerated.
In addition, before the flow is transferred to the proxy server, a point-embedded proxy transfer method is adopted in the method for setting the proxy called by establishing the WebSocket connection at the iOS terminal; the proxy transfer method is used to host a method for setting up a proxy, and sets a proxy address and a proxy port of an SRProxyConnect object, which is created before the method for setting up the proxy, as an address and a port of a proxy server. Under the condition that the WebSocket connection needs to be established by using the proxy, the flow transfer can be realized through the modification of the proxy address and the proxy port of the SRProxyconnect object, and the WebSokey connection speed is accelerated.
Drawings
One or more embodiments are illustrated by the corresponding figures in the drawings, which are not meant to be limiting.
Fig. 1 is a schematic flowchart of a request monitoring method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating a request monitoring method according to an embodiment of the present invention;
fig. 3 is a schematic block diagram of a request monitoring apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a network device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that in various embodiments of the invention, numerous technical details are set forth in order to provide a better understanding of the present application. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
In one embodiment, the request monitoring method comprises the steps of partially burying a point monitoring method in methods called by establishing a WebSocket connection at an iOS end, wherein the monitoring method is used for hosting the called methods; when the iOS terminal initiates the WebSocket connection, index data in the WebSocket connection process is obtained according to the hosting time of the hosting method by the monitoring method, so that the speed of establishing the WebSokey connection by the iOS terminal and the condition of whether the connection is successful or not can be monitored, and when the establishment of the WebSokey connection is slow or fails, targeted measures are improved.
It should be noted that the request monitoring method provided in the embodiment of the present invention may be applied to an Application Performance Management service (APM) product.
The specific flow of the request monitoring method provided by the embodiment of the invention is shown in fig. 1, and comprises the following steps:
s101: and respectively burying point monitoring methods in each method called by establishing the WebSocket connection at the iOS terminal.
The monitoring method may be set according to actual needs, and only needs to implement a corresponding monitoring function in the process of establishing the WebSocket connection at the iOS terminal, which is not particularly limited in the embodiment of the present invention.
The buried point monitoring method can be realized by adding a preset monitoring method into a method called by the iOS end for establishing the WebSokey connection, and when the iOS end establishes the WebSokey connection for calling a corresponding method, the added monitoring method can be called correspondingly, so that the situation that the iOS end establishes the WebSokey connection can be correspondingly monitored. The specific point burying method of the monitoring method can be performed according to actual conditions, and the embodiment of the invention is not particularly limited to this.
S102: when the iOS terminal initiates the WebSocket connection, index data in the WebSocket connection process are obtained according to the hosting time of the monitoring method to the hosting method. Wherein the monitoring method is used for hosting the called method.
The obtained index data in the WebSocket connection process can include index data of any time point in the WebSocket connection process, so that information such as WebSokey connection speed, loading speed and connection success can be analyzed based on the obtained index data, and further targeted measures can be improved, such as repairing of abnormal network states.
Because the monitoring method is added to the method called by the iOS terminal for initiating the WebSokey connection, when the iOS terminal initiates the WebSokey connection, the monitoring method is also triggered, and the process of establishing the WebSokey connection can be correspondingly monitored according to the triggered monitoring method.
According to the request monitoring method provided by the embodiment of the invention, the connection process is monitored according to the monitoring method of the pre-buried point when the iOS terminal initiates the WebSokey connection through the method called by establishing the WebSokey connection at the iOS terminal. The method called by the iOS end for establishing the WebSokect connection is the buried point monitoring method, so that when the iOS end initiates the WebSokect connection, monitoring of the process of establishing the WebSokect connection by the iOS end can be realized according to the buried point monitoring method, the conditions of the speed of establishing the WebSokect connection, the speed of loading and whether the connection is successful or not by the iOS end can be monitored, and targeted measures are improved when the WebSokect connection is established or the WebSokect connection is loaded slowly or the connection is failed.
In a specific example, S101 may include: and adding the monitoring method to a method called by the iOS end for establishing the WebSocket connection by using the exchange function.
The Method for adding the monitoring Method to the Method called by establishing the WebSocket connection by using the swap function means that the Method Swizzle technology is used for adding the monitoring Method to the Method called by establishing the WebSocket connection.
The monitoring method is added to the method called by establishing the WebSokey connection through the exchange function, so that the monitoring method can be embedded in the method called by establishing the WebSokey connection at the iOS end, and traceless embedding of the monitoring method is realized.
In a specific example, when the called methods include an interface calling method before the request start position, such as an open method, the obtained index data includes: a point in time at which a connection is requested to start; when each called method comprises a connection completion method, the acquired index data comprises the following steps: a point in time at which the connection is completed; when each called method comprises a method for successfully establishing the connection, the acquired index data comprises the following steps: the point in time when the Http request begins to be sent, the Http request is used to request an upgrade to the websokcet. The websocket is an upgrading protocol belonging to an http protocol, and for the http protocol in which each message to be sent needs to be responded, the websocket protocol can realize that a client side sends data at any time, and a server side also can send data at any time without waiting for a response of an opposite side. Therefore, by adding a field for requesting upgrading to the websocket on the basis of the http protocol, after the server replies a response supporting the websocket protocol, the websocket protocol can be adopted in subsequent communication.
When each called method comprises a method for starting to receive response header information, the acquired index data comprises the following steps: the sending time of the Http request is the difference between the sending completion time of the Http request and the sending start time of the Http request; when each called method comprises a method for completing receiving response head information, the acquired index data comprises the following steps: a time point at which the response reception is completed, and a response time, wherein the response time is a difference between the time point at which the response reception is completed and a time point at which the response starts to be received.
In addition, when the WebSocket connection is the WSS connection, when each called method includes a connection completion method, the obtained index data further includes: the starting time point of SSL authentication, and the time sum of DNS analysis time and TCP three-way handshake connection time; when each called method comprises a method for successfully establishing the connection, the acquired index data further comprises the following steps: the SSL authentication method includes the steps of obtaining a SSL handshake success time point and a SSL handshake time, wherein the SSL handshake time is the difference between the SSL handshake success time point and the SSL authentication start time point. Because the WSS connection has one more handshake interaction flow than the WS connection, the handshake time of the SSL can also be obtained when the WebSocket connection is the WSS connection.
That is to say, the monitoring method may be added to any one or any combination of an interface calling method, a connection completion method, a http request sending connection establishment method, a response header information start receiving method, and a response header information reception completion method, which are called by the iOS terminal to establish the WebSocket connection and located before the request start position, by using a swap function, so as to obtain various index data in the WebSocket connection process. In one example, the acquired index data is stored in a monitoring object corresponding to the WebSocket connection; and the monitoring object corresponding to the WebSocket connection is created according to the instance object of the WebSocket connection.
It can be understood that the more the monitoring method is added to the above method called by the iOS terminal to establish the websokey connection, the clearer and more complete the monitoring of the situation that the iOS terminal establishes the websokey connection can be realized.
The monitoring method is added to at least one of an interface calling method, a connection completion method, a http request sending connection establishment method, a response header information starting method and a response header information receiving completion method which are called by the iOS terminal to establish the WebSokect connection by using a swap function, so that the embedded point of the monitoring method can be realized, and the condition of establishing the WebSokect connection by the iOS terminal can be monitored.
In a specific example, in S102, that is, when initiating a websokey connection at the iOS terminal, a connection monitoring process according to a monitoring method includes: when the method with the monitoring method at the buried point is called at the iOS terminal to initiate WebSokey connection, the monitoring method of the buried point is called by using a swap function, and the process of the connection is monitored by using the monitoring method.
When the method with the monitoring method at the buried point is called at the iOS terminal to initiate the WebSokey connection, the monitoring method is called by using the preset exchange function, the process of the connection is monitored by using the called monitoring method, and the WebSokey connection established at the iOS terminal can be monitored.
In a specific example, in a case that the iOS initiates a WebSocket connection based on the SRWebSocket-master version framework, the request monitoring method provided in the embodiment of the present invention further includes: and under the condition that the WebSocket connection needs to be established by using the proxy, transferring the traffic to the proxy server, such as transferring the traffic to the CDN server. Therefore, when the WebSokey connection established at the iOS terminal is slow or fails, the flow transfer is realized, and the WebSokey connection speed of the iOS terminal is accelerated. The embodiment of the invention provides a method for transferring flow to a proxy server, and the decision on how to transfer flow based on index data in the WebSocket connection process is not specifically limited.
In one example, before transferring traffic to the proxy server, a method for setting a proxy called by establishing a WebSocket connection on the iOS side, such as a buried point proxy transfer method in an openConnection method; the proxy transfer method is used to host a method for setting a proxy, such as the openConnection method, in which a proxy address and a proxy port of an SRProxyConnect object are set as an address and a port of a proxy server, and the SRProxyConnect object is created before the openConnection method. By the aid of the embedded point proxy transfer method in the method called by the establishment of the WebSokey connection at the iOS terminal, flow transfer can be achieved under the condition that the WebSokey connection needs to be established by the proxy, and the WebSokey connection speed is increased. In addition, in one example, a proxy transfer method may be added to the openConnection method through an exchange function to realize traceless buried points.
That is, the iOS initiates the websokey connection based on the SRWebSocket-master version framework, and after the call of the open method is completed and before the connection completion method is called, the method of the SRProxyConnect class of the proxy transfer of the buried point in the method before the connection is established (e.g., the open connection method) may be performed. For example, after the SRProxyConnect object is created, in the openConnection method called by establishing the WebSokect connection at the iOS terminal, the exchange function burdened point is used to request the proxy transfer method of the corresponding SRProxyConnect object, so that when the establishment of the WebSokect connection at the iOS terminal is slow or fails, the requested traffic is transferred to a proxy server such as a CDN server, the traffic transfer is realized, the speed of the WebSokect connection at the iOS terminal is increased, and the user experience is improved.
In order to further explain the request monitoring method provided by the embodiment of the present invention, a specific example is described below. Please refer to fig. 2, which is a diagram illustrating a principle of a request monitoring method according to an embodiment of the present invention. Specifically, an open method, a connection completion method (connectidodene), a http request sending connection establishment method (didconnect), a response header information starting receiving method (readHTTPHeader) and a response header information receiving completion method (httpheaddidfinished) in establishing the WebSocket connection at the iOS end are used for acquiring index data in the WebSocket connection process by using a monitoring method corresponding to a point burying, and an agent address and an agent port are modified by using an openConnection method point burying agent transfer method, so that the requested traffic is transferred to the agent server. Therefore, when the iOS terminal establishes the WebSokey connection, the corresponding monitoring index can be obtained through the monitoring method of the buried point, and the monitoring of the process of establishing the WebSokey connection by the iOS terminal is realized; and the flow transfer can be carried out by the set proxy transfer method, the WebSokey connection process is accelerated, and the user experience is improved. Fig. 2 is described in detail below:
in step 210, a websocket request using the SRWebSocket framework is initiated by an application (app) on the device.
Then, step 211 is entered, and the open Method of SRWebSocket is called, and the open Method is managed by using a swap function such as Method Swizzle, which is collectively called "hook _ open". Entering hook _ open, firstly acquiring the instance object of the SRWebSocket requested by the websocket, creating a self-defined monitoring object corresponding to the request, acquiring the URL of the request through the instance object of the SRWebSocket requested by the request, and marking the time point of starting connection through the hook _ open, wherein the time point is marked as startConnectts. And setting the key as the SRWebSocket or setting the key as the hash value of the SRWebSocket for storage through monitoring the instance object, wherein the monitoring instances of the current request can be distinguished through the stored key because the requests are concurrent. The request is then returned to the original open method for connection. In another example, without being limited to the open method, any method before SRWebSocket creates a data stream open may be doted.
If the SRWebSocket framework is the current SRWebSocket-master version, a point-buried proxy transfer method can be used in a method of an SRProxConnect class before connection establishment, the method of the SRProxConnect class before connection establishment, such as an openConnection method, is managed, and then two proxy addresses, namely htpProxHost and htpProxPort, and a proxy port are modified through setValue of an object, namely a forKey method, after the management, htpProxHost is set as the address of a proxy server, such as a CDN server, and htpProxPort is set as the port of the proxy server, such as the CDN server. And then returning to the original openConnection for continuing execution to realize the transfer of the traffic. An SRProxyConnect object is created, step 212, and the openConnection method is hosted by the proxy transfer method after being called, step 213, modifying the proxy address and proxy port of the SRProxyConnect object after hosting.
In step 214, after the TCP three-way handshake connection is successful or fails, the method returns to a certain method of the SRWebSocket library, and the method is called connecticdone (connection completion method) because the methods of different versions are different. The method comprises the steps that a connecticdone is managed through a monitoring method hook _ connecticdone with a buried point in the connecticdone, and the time point when the connection of the current connection is completed can be obtained through the time when the hook _ connecticdone currently manages the connecticdone. And acquiring the currently requested monitoring instance by acquiring the current SRWebsocket instance object or the hash value of the SRWebsocket, and then storing the time point of the completion of the connection of the current connection by the requested monitoring instance. This time is labeled endConnectTs. If it is a WSS request, the current time point needs to be saved as the start time point of SSL authentication, and this time is marked as startSSLTs. And acquiring the sum of DNS analysis time and TCP three-way handshake connection time, specifically endConnectTs-startConnectTs.
In step 215, after the request is successfully established, the request enters a method for successfully establishing the SRWebSocket framework connection, which is collectively referred to as a didConnect method. The hosting of the didConnect Method is also implemented using the Method Swizzle technique to bury the monitoring Method in the didConnect, which is collectively referred to as hook _ didConnect. And acquiring the currently requested monitoring instance by acquiring the current SRWebsocket instance object or the hash value of the SRWebsocket. If the request is a WSS request, the current hosting time needs to be marked as the point in time at which the SSL handshake of the monitoring instance succeeds. This time is labeled endSSLTs, while the current hosting time is also labeled as the point in time at which the monitoring instance begins sending an Http request for requesting an upgrade to the websokcet. This time is marked as startSendRequestTs, and if the request is a WSS request, the obtained SSL handshake time is endSSLTs-startSSLTs. Then returns to execute the original didConnect method and continues execution.
In step 216, after the request is successfully established, the request enters a method for starting to receive response header information of the SRWebSocket framework, which is collectively referred to as a readHTTPHeader method. And a Method for monitoring a buried point in a readHTTPHeader by using a Method Swizzle technology is also used for realizing the hosting of the readHTTPHeader Method, wherein the monitoring Method of the buried point in the readHTTPHeader is collectively called hook _ readHTTPHeade. The monitoring instance of the current request is obtained by obtaining the current SRWebSocket instance object or the hash value of the SRWebSocket, and the current hosting time needs to be marked as the time point of the sending completion of the Http request of the monitoring instance. This time is labeled endSendRequestTs, and the time to send the request is endSendRequestTs-startSendRequestTs. The current hosting time is also marked as the point in time at which the response of the monitoring instance begins to be received. This time is labeled startResponeseTs. And then returning to execute the original readHTTPHeader method and continuing to execute.
In step 217, after the weboskcet completes the request response, the method for completing the header information receiving response of the SRWebSocket framework is entered, which is collectively referred to as http headers did finish method. And the Method for monitoring the embedded point in the HTTPHeadsEdFinish by using the Method Swizzle technology is also used for realizing the hosting of the HTTPHeadsEdFinish Method, and the Method for monitoring the embedded point in the HTTPHeadsEdFinish is collectively called hook _ HTTPHeadsEdFinish. And acquiring the currently requested monitoring instance by acquiring the current SRWebsocket instance object or the hash value of the SRWebsocket. The current hosting time needs to be marked as the point in time at which the reception of the Http request response of the monitoring instance is completed. This time is labeled endresponsets. The time to respond to the response is endResposeTs-startResposeTs. And returning to the original executed _ HTTPHeaders DidFinish method to continue the execution.
In step 218, the weboskcet data transmission/reception is started.
By the method for monitoring the buried point called by establishing the WebSokey connection at the iOS end, when the iOS end initiates the WebSokey connection, the connection process is monitored according to the monitoring method of the buried point in advance. The method called by the iOS end for establishing the WebSokect connection is the buried point monitoring method, so that when the iOS end initiates the WebSokect connection, monitoring of the process of establishing the WebSokect connection by the iOS end can be realized according to the buried point monitoring method, the conditions of the speed of establishing the WebSokect connection, the speed of loading and whether the connection is successful or not by the iOS end can be monitored, and targeted measures can be improved when the WebSokect connection is established or the WebSokect connection is loaded slowly or the connection is failed. For example, the connection time of the whole WebSokect can be obtained from the monitored first time point to the monitored last time point, so that the speed of establishing the WebSokect connection by the iOS terminal can be monitored, and whether the connection is successful or not can be determined according to whether each time point can be monitored or not. In addition, because each time point in the whole WebSokect connection process is monitored, each stage time or time point in the WebSokect connection process can be analyzed according to actual requirements.
In one example, index data in the WebSocket connection process can be fed back to the server, so that the server obtains the speed of establishing the WebSocket connection, the speed of loading, and whether the connection is successful, and further, when the WebSocket connection is established slowly or the loading is slow or the connection fails, a targeted measure is improved.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the steps contain the same logical relationship, which is within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
In a specific example, the request monitoring apparatus 200, as shown in fig. 3, includes a site module 201 and a monitoring module 202, and the functions of the modules are detailed as follows:
the embedded point module 201 is used for respectively embedding point monitoring methods in the methods called by establishing the WebSocket connection at the iOS terminal; wherein the monitoring method is used for hosting the called method.
The monitoring module 202 is configured to, when the iOS initiates a WebSocket connection, obtain index data in the WebSocket connection process according to a hosting time of a monitoring method for a hosting method. In one example, the acquired index data is stored in a monitoring object corresponding to the WebSocket connection; and the monitoring object corresponding to the WebSocket connection is created according to the instance object of the WebSocket connection.
Further, the buried point module 201 is further configured to: and adding the monitoring method to each method called by establishing the WebSocket connection at the iOS terminal by using a swap function. In one example, when the called methods include an interface calling method before the request start position, the acquired index data includes: a point in time at which a connection is requested to start; when each called method comprises a connection completion method, the acquired index data comprises the following steps: a point in time at which the connection is completed; when each called method comprises a method for successfully establishing the connection, the acquired index data comprises the following steps: the time point when the Http request starts to be sent is used for requesting upgrading of the websokcet; when each called method comprises a method for starting to receive response header information, the acquired index data comprises: the sending time of the Http request is the difference between the sending completion time of the Http request and the sending start time of the Http request; when each called method comprises a method for completing receiving response head information, the acquired index data comprises the following steps: a time point at which the response reception is completed, and a response time, wherein the response time is a difference between the time point at which the response reception is completed and a time point at which the response starts to be received. In addition, under the condition that the WebSocket connection is the WSS connection, when each called method comprises a connection completion method, the obtained index data further comprises the following steps: the method comprises the following steps of starting a time point of SSL authentication, and the sum of DNS analysis time and TCP three-way handshake connection time, wherein the sum of the DNS analysis time and the TCP three-way handshake connection time is the difference between a time point of connection completion and a time point of connection starting request; when each called method comprises a method for successfully establishing the connection and the acquired index data, the method also comprises the following steps: the SSL authentication method includes the steps of obtaining a SSL handshake success time point and a SSL handshake time, wherein the SSL handshake time is the difference between the SSL handshake success time point and the SSL authentication start time point. The monitoring method is added to any one or any combination of an interface calling method (such as an open method) before a request starting position called by an iOS terminal for establishing the WebSocket connection, a connection completion method, a http request sending connection establishment method, a method for starting to receive response header information and a method for receiving response header information completion, so that various index data in the WebSocket connection process can be acquired.
Further, the monitoring module 202 is further configured to: when the method with the monitoring method at the embedded point is called at the iOS end to initiate WebSocket connection, the monitoring method is called by using a swap function; and acquiring index data in the WebSocket connection process according to the hosting time of the monitoring method to the hosting method.
Further, the request monitoring apparatus 200 according to the embodiment of the present invention further includes an agent module (not shown in the figure), where the agent module is configured to: and under the condition that the WebSocket connection needs to be established by using the proxy, the flow is transferred to the proxy server, so that the flow transfer is realized, and the speed of the WebSokey connection at the iOS end is accelerated.
Further, the embedded point module 201 is further configured to embed a point proxy transfer method in a method for setting a proxy, called by establishing a WebSocket connection at the iOS terminal, before transferring a flow to the proxy server; the proxy transfer method is for hosting a method for setting a proxy, setting a proxy address and a proxy port of an SRProxyConnect object as an address and a port of a proxy server, wherein the SRProxyConnect object is created before the openConnection method. In one example, a traceless buried point is implemented using a swap function to add a proxy transfer method to the method for setting the proxy.
It should be understood that the present embodiment is an apparatus embodiment corresponding to the method embodiment, and the present embodiment can be implemented in cooperation with the method embodiment. The related technical details mentioned in the foregoing method embodiments are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related art details mentioned in the present embodiment can also be applied to the foregoing method embodiments.
It should be noted that, all the modules involved in this embodiment are logic modules, and in practical application, one logic unit may be one physical unit, may also be a part of one physical unit, and may also be implemented by a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, a unit which is not so closely related to solve the technical problem proposed by the present invention is not introduced in the present embodiment, but this does not indicate that there is no other unit in the present embodiment.
In one embodiment, a network device is involved, as shown in fig. 4, comprising at least one processor 301; and a memory 302 communicatively coupled to the at least one processor 301; the memory 302 stores instructions executable by the at least one processor 301, and the instructions are executed by the at least one processor 301, so that the at least one processor 301 can perform the request monitoring method.
Where the memory 302 and the processor 301 are coupled in a bus, the bus may comprise any number of interconnected buses and bridges, the buses coupling one or more of the various circuits of the processor 301 and the memory 302. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 301 is transmitted over a wireless medium through an antenna, which further receives the data and transmits the data to the processor 301.
The processor 301 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 302 may be used to store data used by processor 301 in performing operations.
In one embodiment, a computer-readable storage medium stores a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
That is, those skilled in the art can understand that all or part of the steps in the method of the foregoing embodiments may be implemented by a program to instruct related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific embodiments for practicing the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.

Claims (10)

1. A request monitoring method, comprising:
respectively burying point monitoring methods in each method called by establishing WebSocket connection at the iOS terminal; wherein the monitoring method is used for hosting the called method;
and when the iOS terminal initiates the WebSocket connection, acquiring index data in the WebSocket connection process according to the hosting time of the monitoring method on the hosted method.
2. The request monitoring method of claim 1, wherein the method called by establishing the WebSocket connection at the iOS terminal includes:
and adding the monitoring method to each method called by the iOS end for establishing the WebSocket connection by using a swap function.
3. The request monitoring method according to claim 2, wherein when the iOS initiates a WebSocket connection, acquiring index data in the WebSocket connection process according to a hosting time of the monitoring method for the hosted method, includes:
when the method with the monitoring method at the embedded point is called at the iOS terminal to initiate WebSocket connection, the monitoring method is called by using the exchange function;
and acquiring index data in the WebSocket connection process according to the hosting time of the monitoring method to the hosted method.
4. The request monitoring method according to claim 1,
when each method called comprises an interface calling method before a request starting position, the acquired index data comprises: a point in time at which a connection is requested to start;
when each called method comprises a connection completion method, the acquired index data comprises: a point in time at which the connection is completed;
when each called method comprises a method for successfully establishing the connection, the acquired index data comprises the following steps: a point in time to begin sending an Http request for requesting an upgrade to a websokcet;
when each called method comprises a method for starting to receive response header information, the acquired index data comprises: the method comprises the steps of sending an Http request, wherein the Http request comprises a time point when sending of the Http request is completed, a time point when sending of the Http request, and a time point when a response starts receiving, wherein the time point when sending of the Http request is a difference between the time point when sending of the Http request is completed and the time point when sending of the Http request is started;
when each called method comprises a method for completing receiving response header information, the acquired index data comprises: a time point at which the response reception is completed, and a response time, wherein the response time is a difference between the time point at which the response reception is completed and a time point at which the response starts to be received.
5. The request monitoring method according to claim 4, wherein, in the case where the WebSocket connection is a WSS connection,
when each called method comprises a connection completion method, the acquired index data further comprises: the starting time point of SSL authentication, and the time sum of DNS resolution time and TCP three-way handshake connection time, wherein the time sum of the DNS resolution time and the TCP three-way handshake connection time is the difference between the time point of connection completion and the time point of connection starting request;
when the called methods include a method for successfully establishing the connection, the acquired index data further includes: the SSL authentication method comprises a time point when SSL handshake succeeds and SSL handshake time, wherein the SSL handshake time is the difference between the time point when SSL handshake succeeds and the starting time point of SSL authentication.
6. The request monitoring method according to any one of claims 1 to 5, wherein, in a case where the iOS initiates the WebSocket connection based on the SRWebSocket-master version framework, further comprising:
and in the case that the WebSocket connection needs to be established by using the proxy, transferring the traffic onto the proxy server.
7. The request monitoring method of claim 6, wherein prior to said transferring traffic to a proxy server, the method further comprises:
in the method for setting the proxy called by establishing the WebSocket connection at the iOS terminal, a buried point proxy transfer method is adopted;
the proxy transfer method is used for hosting the method for setting up the proxy, and setting a proxy address and a proxy port of an SRProxConnect object as an address and a port of the proxy server, wherein the SRProxConnect object is created before the method for setting up the proxy.
8. The request monitoring method according to any one of claims 1 to 5, wherein the acquired index data is stored in a monitoring object corresponding to the WebSocket connection;
and the monitoring object corresponding to the WebSocket connection is created according to the instance object of the WebSocket connection.
9. A network device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the request monitoring method of any one of claims 1 to 8.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a request monitoring method according to any one of claims 1 to 8.
CN202111498465.0A 2021-12-09 2021-12-09 Request monitoring method, network device and storage medium Pending CN114363204A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111498465.0A CN114363204A (en) 2021-12-09 2021-12-09 Request monitoring method, network device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111498465.0A CN114363204A (en) 2021-12-09 2021-12-09 Request monitoring method, network device and storage medium

Publications (1)

Publication Number Publication Date
CN114363204A true CN114363204A (en) 2022-04-15

Family

ID=81098306

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111498465.0A Pending CN114363204A (en) 2021-12-09 2021-12-09 Request monitoring method, network device and storage medium

Country Status (1)

Country Link
CN (1) CN114363204A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979240A (en) * 2022-07-26 2022-08-30 杭州奇思妙行网络科技有限公司 Distributed WebSocket access system and method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015196821A1 (en) * 2014-06-27 2015-12-30 中兴通讯股份有限公司 Method and apparatus for monitoring websocket server
CN107562426A (en) * 2017-09-04 2018-01-09 清华大学 Without the method and system for burying point type high in the clouds collection and analysis browser Trace
CN113556260A (en) * 2020-04-24 2021-10-26 北京三快在线科技有限公司 Flow monitoring method and device, storage medium and electronic equipment
CN113765740A (en) * 2021-08-03 2021-12-07 网宿科技股份有限公司 Method and device for monitoring Dio network request

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015196821A1 (en) * 2014-06-27 2015-12-30 中兴通讯股份有限公司 Method and apparatus for monitoring websocket server
CN105306288A (en) * 2014-06-27 2016-02-03 中兴通讯股份有限公司 WebSocket server monitoring method and device
CN107562426A (en) * 2017-09-04 2018-01-09 清华大学 Without the method and system for burying point type high in the clouds collection and analysis browser Trace
CN113556260A (en) * 2020-04-24 2021-10-26 北京三快在线科技有限公司 Flow monitoring method and device, storage medium and electronic equipment
CN113765740A (en) * 2021-08-03 2021-12-07 网宿科技股份有限公司 Method and device for monitoring Dio network request

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
肖磊;: "VxWorks下基于socket的网络通信设计", 计算机与网络, no. 12, 26 June 2013 (2013-06-26), pages 66 - 68 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979240A (en) * 2022-07-26 2022-08-30 杭州奇思妙行网络科技有限公司 Distributed WebSocket access system and method
CN114979240B (en) * 2022-07-26 2022-10-25 杭州奇思妙行网络科技有限公司 Distributed WebSocket access system and method

Similar Documents

Publication Publication Date Title
US8069251B2 (en) System and/or method for client-driven server load distribution
US10623699B2 (en) Device, system and method for embedded video chat
CN108055311B (en) HTTP asynchronous request method, device, server, terminal and storage medium
KR101805458B1 (en) Method for supporting websocket and web server and web application server using the same
CN110830516B (en) Network access method, device, network control equipment and storage medium
CN113382048A (en) Message pushing method, system, equipment and storage medium
CN108886533B (en) Accelerating connections to host servers
EP2693691A1 (en) Method and apparatus for initializing gateway in device management system
CN114363204A (en) Request monitoring method, network device and storage medium
CN111064742A (en) Method, device and related equipment for realizing intranet access based on network agent
WO2013189398A2 (en) Application data push method, device, and system
CN111404842B (en) Data transmission method, device and computer storage medium
KR101432326B1 (en) Host posing network device and method thereof
JP2016154332A (en) Devices and methods for performing tcp handshakes
CN113162922B (en) Client data acquisition method and device, storage medium and electronic equipment
CN111131470B (en) Terminal device, data processing method thereof and data processing system
CN114584603A (en) Method and device for connecting desktop client software and server and readable storage medium
JP2008521297A (en) A method for ensuring that a service platform obtains user terminal information in a multi-application protocol
CN112118284A (en) Gateway device-oriented http data request method, device and medium
CN111490997A (en) Task processing method, agent system, service system and electronic equipment
CN111107663B (en) Data transmission method and device, storage medium and electronic device
CN111367477B (en) 3D printing device, connection method, data processing device, control method and medium
CN117336213B (en) Subsystem monitoring method, system and equipment
CN113157615B (en) Service bus communication method, electronic equipment and computer storage medium
CN111049754B (en) Data communication method, device, equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination