Heartbeat control method of online document, medium, electronic equipment and program product
By dynamically adjusting the time interval for the client to send heartbeat requests, the performance waste caused by the large number of hop requests in the existing technology is solved, and a more efficient online document access experience is achieved.
Patent Information
- Application Number
- CN202411679183.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-18
AI Technical Summary
现有在线文档的心跳请求机制使用固定的时间间隔,导致心跳请求量大,造成服务端性能浪费,并影响客户端性能。
By receiving the heartbeat request sent by the client, the time interval of the heartbeat request is dynamically adjusted according to the running status of the online document in the client, and the time interval is sent to the client.
Dynamically adjusting the time interval of heartbeat requests significantly reduces the number of heartbeat requests in online documents, avoids waste of client and server performance, and reduces network costs.
Smart Images

Figure CN119484612A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a heartbeat control method, medium, electronic device and program product for an online document. Background Art
[0002] Online documents generally use heartbeat requests to maintain the online and offline status of clients accessing online documents. In related technologies, clients generally send heartbeat requests to servers at fixed time intervals to maintain the online status of clients. However, sending heartbeat requests to servers at fixed time intervals will not only lead to a large number of heartbeat requests, resulting in a waste of server performance, but also when a client opens multiple online documents, the number of heartbeat requests sent by the client will increase, resulting in a loss of client performance. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, the present disclosure provides a heartbeat control method for an online document, which is executed by a server and includes: Receiving a heartbeat request for an online document sent by a client, wherein each heartbeat request sent by the client includes a running status of the online document in the client; Determine, according to the running status, the time interval for the client to send a heartbeat request next time; The time interval is sent to the client.
[0005] In a second aspect, the present disclosure provides a heartbeat control method for an online document, which is executed by a client and includes: Sending a heartbeat request for the online document to the server, wherein each heartbeat request sent by the client includes the running status of the online document in the client; receiving a time interval sent by the server, wherein the time interval is determined by the server according to the running state; A heartbeat request for the online document is sent to the server according to the time interval.
[0006] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect, or implements the steps of the method described in the second aspect.
[0007] In a fourth aspect, the present disclosure provides an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect, or to implement the steps of the method described in the second aspect.
[0008] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in the first aspect, or implements the steps of the method described in the second aspect.
[0009] Based on the above technical solution, by receiving the heartbeat request for the online document sent by the client, determining the time interval for the client to send the heartbeat request next time according to the running status of the online document included in the heartbeat request in the client, and sending the time interval to the client, the time interval for the online document page in the client to send the heartbeat request can be dynamically adjusted, thereby greatly reducing the number of heartbeat requests for the online document, which can not only avoid affecting the performance of the client, but also avoid wasting the performance of the server and reduce network costs.
[0010] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 The figure is a flowchart of a heartbeat control method for an online document according to some embodiments.
[0012] Figure 2 is a schematic diagram illustrating time intervals according to some embodiments.
[0013] Figure 3 is a flowchart of a heartbeat control method for an online document according to some other embodiments.
[0014] Figure 4 is a schematic diagram of sending a heartbeat request according to some embodiments.
[0015] Figure 5 It is a structural schematic diagram of a heartbeat control device for an online document according to some embodiments.
[0016] Figure 6 It is a structural schematic diagram of a heartbeat control device for an online document according to some other embodiments.
[0017] Figure 7 is a schematic diagram of the structure of an electronic device according to some embodiments. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0020] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0021] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0024] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0025] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information (the running status of the online document in the client). Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0026] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0027] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0028] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0029] Figure 1 FIG. 1 is a flow chart of a heartbeat control method for an online document according to some embodiments. Figure 1 As shown, the embodiment of the present disclosure provides a heartbeat control method for an online document, which can be executed by a server, and specifically can be executed by a heartbeat control device for an online document, which can be implemented by software and / or hardware and configured in the server. For example, the server can refer to a server. Figure 1 As shown, the method may include the following steps.
[0030] In step 110, a heartbeat request for an online document sent by a client is received. Each heartbeat request sent by the client includes the running status of the online document in the client.
[0031] Here, online documents refer to documents that are accessed, edited, and managed through the Internet. Multiple users can synchronously perform corresponding operations on online documents in a collaborative office manner. It should be understood that online documents can be documents in various formats, such as text-type documents, table-type documents, presentation-type documents, etc. Correspondingly, the server can be a server that provides online document services. The client can be a terminal device that accesses online documents in the server.
[0032] A heartbeat request for an online document sent by a client to a server is a message or request sent periodically by a client to a server to indicate that the client is still active and maintains a connection with the server.
[0033] The running state of the online document in the client may refer to the interactive state of the online document with the user in the client. The running state may include an active state and an inactive state. The active state may be equivalent to the foreground state, indicating that the online document is running and can interact with the user. The inactive state is opposite to the active state, indicating that the online document is running but is not the focus of the user's current interaction. For example, when the online document is in the background state, the online document cannot accept direct input from the user and is covered by other windows, and the online document is in an inactive state.
[0034] Each heartbeat request sent by the client to the server carries the current running status of the online document in the client. Moreover, when the current running status of the online document changes, the client can send a heartbeat request carrying the current running status to the server, so that the server can dynamically adjust the time interval for the client to send subsequent heartbeat requests.
[0035] Exemplarily, the running status carried in the heartbeat request can be distinguished by different tags, which is not specifically limited in the embodiments of the present disclosure.
[0036] In step 120, the time interval for the client to send a heartbeat request next time is determined according to the running status.
[0037] Here, different time intervals may correspond to different operating states. For example, for an active state, the corresponding time interval is 2 minutes, and for an inactive state, the corresponding time interval is 5 minutes. Of course, in other implementations, the server may also determine the time interval for the client to send a heartbeat request next time by different logics according to different operating states.
[0038] When the server receives the heartbeat request sent by the client, it responds to the heartbeat request and determines the time interval for the client to send the heartbeat request to the server next time according to the running status carried in the heartbeat request. Of course, the server receives the heartbeat request sent by the client, which means that the client is in an active state. Accordingly, the server responds to the heartbeat request, resets the timeout timer corresponding to the client, and returns a heartbeat response to the client, so that the client determines that the server has received the heartbeat request according to the heartbeat response. It should be understood that when the client is online, the server can return the latest document content to the client at regular intervals.
[0039] In step 130, the time interval is sent to the client.
[0040] Here, after the server determines the time interval for the client to send the next heartbeat request, the server sends the time interval to the client, so that the client sends the heartbeat request for the online document to the server according to the time interval. For example, the time when the client first sends the heartbeat request to the server is 13:13:00. If the server determines that the time interval is 2 minutes according to the running status, the time when the client sends the heartbeat request to the server next time is 13:15:00.
[0041] It is worth noting that the next heartbeat request sent by the client to the server will also carry the running status of the online document in the client, so that the server can determine a new time interval based on the running status, and dynamically determine the time interval for the client to send heartbeat requests based on each running status.
[0042] Therefore, by receiving the heartbeat request for the online document sent by the client, determining the time interval for the client to send the heartbeat request next time according to the running status of the online document included in the heartbeat request in the client, and sending the time interval to the client, the time interval for the online document page in the client to send the heartbeat request can be dynamically adjusted, thereby greatly reducing the number of heartbeat requests for the online document, which can not only avoid affecting the performance of the client, but also avoid wasting the performance of the server and reduce network costs.
[0043] In some practicable implementations, in step 120, when the running status indicates that the online document is in an inactive state in the client, the time interval may be determined according to document usage information of the online document.
[0044] Here, the document usage information may refer to the usage of the online document in the server by the user. Exemplarily, the usage information includes the version information of the online document and the number of clients accessing the online document.
[0045] The version information of the online document may refer to the version number of the online document. It should be understood that when the content of the online document changes, the version information of the online document will change. The number of clients accessing the online document may refer to the total number of clients accessing the online document at the same time. The number of clients accessing the online document can actually be understood as the number of users currently accessing the online document.
[0046] When the running status indicates that the online document is inactive in the client, it means that the online document is in the background state in the client, and the user corresponding to the client has a low demand for obtaining the content of the online document. Accordingly, the time interval for the client to send a heartbeat request next time can be determined based on the document usage information of the online document.
[0047] It is worth noting that different time intervals may correspond to different document usage information, so as to dynamically adjust the time interval for the client to send a heartbeat request next time.
[0048] Therefore, when the online document is inactive in the client, the time interval for the client to send a heartbeat request for the online document next time can be dynamically determined according to the document usage information of the online document, so as to reduce the request amount of the online document to send the heartbeat request.
[0049] In some feasible implementations, when the number of clients is less than or equal to a preset number and the version information of the online document has not changed, the time interval is determined based on the number of consecutive heartbeat requests of a preset type received by the server, where the preset type of heartbeat request is a heartbeat request that indicates that the online document is in an inactive state in the client.
[0050] Here, the preset number may be 1. Of course, the size of the preset number may also be set according to actual conditions. When the number of clients accessing the online document is less than or equal to the preset number, it indicates that the number of clients accessing the online document is small or one client accesses the online document. The fact that the version information of the online document has not changed indicates that the content of the online document has not changed. It should be noted that the fact that the version information of the online document has not changed may mean that the version information of the online document has not changed within a preset time period, indicating that the content of the online document has not changed for a long time.
[0051] Therefore, when the number of clients is less than or equal to the preset number and the version information of the online document has not changed, it means that the number of users accessing the online document at the same time is small and the content of the online document has not changed. Accordingly, the time interval can be determined according to the number of heartbeat requests of the preset type received continuously by the server. The preset type of heartbeat request is a heartbeat request that indicates that the online document is inactive in the client.
[0052] It is worth noting that the number of times the server continuously receives heartbeat requests of a preset type may refer to the number of times the server continuously receives heartbeat requests carrying an inactive state sent by the client.
[0053] For example, the running status carried in the heartbeat request sent by client A to the server for the first time is active, the running status carried in the heartbeat request sent by client A to the server for the second time is inactive, the running status carried in the heartbeat request sent by client A to the server for the third time is inactive, and the running status carried in the heartbeat request sent by client A to the server for the fourth time is inactive. Then the number of times the server continuously receives heartbeat requests of the preset type is 3.
[0054] It should be understood that when the server receives a heartbeat request carrying an active state after a heartbeat request of a preset type, the number of times the server continuously receives heartbeat requests of the preset type will be recalculated. For example, if the running state carried in the heartbeat request sent by client A to the server for the fifth time is active, the number of times the server continuously receives heartbeat requests of the preset type is cleared to 0. If the running state carried in the heartbeat request sent by client A to the server for the sixth time is inactive, the number of times the server continuously receives heartbeat requests of the preset type is 1.
[0055] Different time intervals may correspond to different times. The server may dynamically adjust the time interval at which the client sends the heartbeat request for the online document according to the different times.
[0056] In some embodiments, the time interval is positively correlated with the number of times, that is, as the number of times increases, the time interval for the client to send the heartbeat request for the online document will also increase.
[0057] It should be understood that, the greater the number of times, the longer the online document is inactive in the client, and accordingly, the time interval for the client to send heartbeat requests for the online document will also increase accordingly.
[0058] For example, when the number is 1, the time interval may be 5 minutes, when the number is 2, the time interval may be 10 minutes, and when the number is 3, the time interval may be 20 minutes. Of course, after the time interval increases to the target duration (such as 2 hours), the time interval may not increase with the increase in the number of times.
[0059] The running status carried in the heartbeat request sent by client A to the server for the first time is active, and the time interval for the next heartbeat request sent by the client is 2 minutes. The running status carried in the heartbeat request sent by client A to the server for the second time is inactive, and the time interval for the next heartbeat request sent by the client is 5 minutes. The running status carried in the heartbeat request sent by client A to the server for the third time is inactive, and the time interval for the next heartbeat request sent by the client is 10 minutes. The running status carried in the heartbeat request sent by client A to the server for the fourth time is inactive, and the time interval for the next heartbeat request sent by the client is 10 minutes. The running status carried in the heartbeat request sent by client A to the server for the fifth time is active, and the time interval for the next heartbeat request sent by the client is 2 minutes. The running status carried in the heartbeat request sent by client A to the server for the sixth time is inactive, and the time interval for the next heartbeat request sent by the client is 5 minutes.
[0060] Therefore, through the above implementation, the time interval for the client to send heartbeat requests for online documents can be dynamically adjusted, and the longer the online document is inactive, the longer the time interval for the client to send the heartbeat request next time, so as to reduce the request amount of the client to send heartbeat requests.
[0061] In some feasible implementations, when the number of clients is greater than a preset number or the version information of the online document is changed, the first time interval is determined as the time interval.
[0062] Here, if the number of clients accessing the online document is greater than the preset number, it means that the number of users accessing the online document at the same time is large, and the probability of content change in the online document is greater. A change in the version information of the online document indicates that the content of the online document has changed.
[0063] Therefore, when the number of clients is greater than a preset number or the version information of the online document changes, the first time interval may be determined as the time interval for the client to send a heartbeat request next time.
[0064] Among them, the size of the first time interval can be set according to actual conditions. In the embodiment of the present disclosure, the first time interval can be 5 minutes. It is worth noting that the first time interval can be greater than the second time interval, and the second time interval is the time interval for sending heartbeat requests when the online document is active in the client. Of course, the first time interval can be greater than the second time interval, and the first time interval can be less than or equal to the minimum time interval determined according to the number of consecutive heartbeat requests of the preset type received by the server.
[0065] For example, the running status carried in the heartbeat request sent by client A to the server for the first time is active, and the time interval for the client to send the next heartbeat request is 2 minutes (the second time interval). The running status carried in the heartbeat request sent by client A to the server for the second time is inactive. If the number of clients is greater than the preset number or the version information of the online document has changed, the time interval for the client A to send the heartbeat request next time is 5 minutes (the first time interval). The running status carried in the heartbeat request sent by client A to the server for the third time is inactive. If the number of clients is less than or equal to the preset number and the version information of the online document has not changed, the time interval for the client A to send the heartbeat request next time is 10 minutes (the time interval determined according to the number of times).
[0066] Therefore, through the above implementation, the first time interval is determined as the time interval for the client to send a heartbeat request next time. When a large number of clients access the online document at the same time or the content of the online document changes, even if the online document is inactive, the client can still quickly obtain the changed document content of the online document.
[0067] In some practicable implementations, in step 120, when the running state represents that the online document is in an active state in the client, the second time interval is determined as the time interval.
[0068] Here, the second time interval may be 2 minutes. Of course, the second time interval may also be set according to actual conditions.
[0069] The second time interval is smaller than a time interval for sending a heartbeat request when the online document is in an inactive state in the client.
[0070] For example, in some embodiments, the second time interval may be smaller than the first time interval. Detailed description of the first time interval may refer to the above embodiment, which will not be repeated here.
[0071] It is worth noting that when the online document is in an active state, the time interval at which the server sends the content to the client is the second time interval, so that the client can quickly obtain the document content of the online document. When the online document is in an inactive state, the time interval at which the server sends the content to the client is the first time interval greater than the second time interval, or the time interval at which the server sends the content to the client is the time interval obtained according to the number of times.
[0072] Therefore, through the above implementation, when the online document is active, the time interval for the client to send heartbeat requests to the server is shorter than the time interval for sending heartbeat requests when the online document is inactive, so that the client can quickly obtain the content of the online document when the online document is active.
[0073] Figure 2 is a schematic diagram showing time intervals according to some embodiments. Figure 2 As shown, at time 00:00:00, the client opens the online document, at time 00:00:02, the client sends a heartbeat request including the activity status to the server, and the server sends it at a time interval of 2 minutes. If the running status of the server has not changed, then at time 00:02:02 the client sends a heartbeat request including the activity status to the server, and the server sends it at a time interval of 2 minutes. If the running status of the server has not changed, then at time 00:04:02 the client sends a heartbeat request including the activity status to the server, and the server sends it at a time interval of 2 minutes.
[0074] That is, between time 00:04:02 and time 00:06:02, if the running state of the online document has not changed, the client will send a heartbeat signal including the active state to the server at time 00:06:02. However, at time 00:05:10, the online document switches from the active state to the inactive state, and the client can send a heartbeat request including the inactive state to the server at time 00:06:02.
[0075] After the server receives the heartbeat request including the inactive state for the first time, it determines the time interval according to the document usage information of the online document. Assuming that the determined time interval is 5 minutes, the client can send the heartbeat request including the inactive state to the server at time 00:11:02. At this time, the server receives the heartbeat request including the inactive state for the second time. As the number of times increases, the time interval also increases accordingly. Then the client can send the heartbeat request including the inactive state to the server at time 00:21:02.
[0076] Figure 3 FIG. 1 is a flow chart of a heartbeat control method for an online document according to some other embodiments. Figure 3 As shown, the embodiment of the present disclosure provides a heartbeat control method for an online document, which can be executed by a client, and specifically can be executed by a heartbeat control device for an online document, which can be implemented by software and / or hardware and configured in the client. Exemplarily, the client can refer to a terminal device. Figure 3 As shown, the method may include the following steps.
[0077] S310, sending a heartbeat request for the online document to the server, where each heartbeat request sent by the client includes the running status of the online document in the client; S320, receiving a time interval sent by the server, wherein the time interval is determined by the server according to an operation status; S330: Send a heartbeat request for the online document to the server according to a time interval.
[0078] It is worth noting that the detailed description of the above steps S310 to S330 can refer to the relevant description of the above embodiments, which will not be repeated here.
[0079] Therefore, through the above steps S310 to S330, the time interval for sending heartbeat requests by the online document page in the client can be dynamically adjusted, thereby greatly reducing the amount of heartbeat requests for online documents, which can not only avoid affecting the performance of the client, but also avoid wasting performance on the server and reduce network costs.
[0080] In some feasible implementations, in step S330, in response to the running state of the online document changing within a time interval, a heartbeat request for the online document may be sent to the server according to the changed running state of the online document; or in response to the running state of the online document not changing within the time interval, a heartbeat request for the online document may be sent to the server when the time interval is reached.
[0081] Here, the running state of the online document changes within the time interval means that the running state of the online document changes within the received time interval. The running state changes may be from an active state to an inactive state or from an inactive state to an active state.
[0082] For example, the client sends the first heartbeat request to the server at 15:13:00. The running status carried in the heartbeat request is active. The server sends the request at an interval of 2 minutes. If the online document switches from active to inactive between 15:13:00 and 15:15:00, it means that the running status of the online document changes within the time interval.
[0083] When the running state of the online document does not change within the time interval, the client may send a heartbeat request for the online document to the server when the time reaches the time interval.
[0084] When the running state of the online document changes within a time interval, the client sends a heartbeat request for the online document to the server according to the changed running state of the online document.
[0085] In some embodiments, the client may immediately send a heartbeat request for the online document to the server, where the heartbeat request includes the running status of the online document after the change.
[0086] That is to say, when the client's operating status changes, the client may not send the next heartbeat request after the received time interval, but immediately send a heartbeat request carrying the changed operating status, so that the server can adjust the time interval according to the changed operating status in time.
[0087] In other embodiments, a target time may be determined, and when the time interval between the current time and the target time reaches the time interval last received that matches the changed running state, a heartbeat request including the changed running state may be sent to the server.
[0088] The target time is the time when the client last sent a heartbeat request including the same running state as the changed running state to the server.
[0089] For example, if the changed running state is inactive, the target time is the time when the client last sent a heartbeat request carrying the inactive state to the server.
[0090] It is worth noting that if the client sends a heartbeat request including the changed running state for the first time, the target time cannot be found. At this time, the time when the heartbeat request was last sent can be determined as the target time.
[0091] For example, if the changed running state is an inactive state, and if the client has not previously sent a heartbeat request including an inactive state, the time when the last heartbeat request including an active state was sent may be determined as the target time.
[0092] When the time interval between the current time and the target time reaches the time interval received last time that matches the changed running state, the client immediately sends a heartbeat request including the changed running state to the server.
[0093] It is worth noting that if the client has not previously received a time interval that matches the changed running state, the last received time interval of any type may be used as the last received time interval that matches the changed running state.
[0094] For example, if the changed running state is inactive, if the client has not previously sent a heartbeat request including the inactive state, the client will not receive the time interval corresponding to the inactive state. At this time, the time interval corresponding to the last received active state can be determined as the last received time interval matching the inactive state.
[0095] Figure 4 FIG. 1 is a schematic diagram of sending a heartbeat request according to some embodiments. Figure 4 As shown, at time 00:00:00, the client opens the online document, at time 00:00:02, the client sends a heartbeat request including the activity status to the server, and the server sends it at a time interval of 2 minutes. If the running status of the server has not changed, then at time 00:02:02 the client sends a heartbeat request including the activity status to the server, and the server sends it at a time interval of 2 minutes. If the running status of the server has not changed, then at time 00:04:02 the client sends a heartbeat request including the activity status to the server, and the server sends it at a time interval of 2 minutes.
[0096] That is, between time 00:04:02 and time 00:06:02, if the running state of the online document has not changed, the client will send a heartbeat signal including the active state to the server at time 00:06:02. However, at time 00:05:10, the online document switches from the active state to the inactive state, and the client determines the target time of the last heartbeat request including the inactive state. Since the client has not sent a heartbeat request including the inactive state before, the target time can be the time of the last heartbeat request including the active state (00:04:02).
[0097] Similarly, since the client has not sent a heartbeat request including an inactive state before, the client will not receive a time interval matching the inactive state. The time interval corresponding to the last received active state (2 minutes) can be used as the time interval matching the inactive state.
[0098] Since the time interval between 00:05:10 and 00:04:02 is less than 2 minutes, the client sends a heartbeat request including an inactive state to the client at time 00:06:02. The server sends a 5-minute time interval to the client based on the first received heartbeat request including an inactive state. That is, if the running state of the online document has not changed, the client will send a heartbeat request including an inactive state to the server again at time 00:11:02.
[0099] Assume that at the first time 401, the online document switches from an inactive state to an active state, and the time interval between the first time 401 and the time (00:04:02) when the client last sent a heartbeat request including the active state is greater than the time interval (2 minutes) when the activity state match was last received, then the client sends a heartbeat request including the active state to the server at the first time 401.
[0100] Assume that at the second time 402, the online document switches from the active state to the inactive state, and the time interval between the second time 402 and the time (00:06:02) when the client last sent a heartbeat request including the inactive state is less than the time interval (5 minutes) when the last inactive state match was received, then the client sends a heartbeat request including the inactive state to the server at time 00:11:02.
[0101] Therefore, through the above implementation, when the running status of the online document changes frequently, the request amount of the heartbeat request sent by the client to the server can also be reduced.
[0102] Figure 5 FIG. 1 is a schematic diagram of a heartbeat control device for an online document according to some embodiments. Figure 5As shown, the embodiment of the present disclosure provides a heartbeat control device 500 for an online document, which is configured at a server end and may include: The first receiving module 501 is configured to receive a heartbeat request for an online document sent by a client, wherein each heartbeat request sent by the client includes a running status of the online document in the client; The determination module 502 is configured to determine, according to the running state, a time interval for the client to send a heartbeat request next time; The first sending module 503 is configured to send the time interval to the client.
[0103] Optionally, the determining module 502 is specifically configured to: When the running state indicates that the online document is in an inactive state in the client, the time interval is determined according to document usage information of the online document.
[0104] Optionally, the document usage information includes version information of the online document and the number of clients accessing the online document; The determination module 502 is specifically configured to: When the number of clients is less than or equal to a preset number and the version information of the online document has not changed, the time interval is determined according to the number of times the server continuously receives heartbeat requests of a preset type, where the preset type of heartbeat request is a heartbeat request that indicates that the online document is in an inactive state in the client.
[0105] Optionally, the size of the time interval is positively correlated with the size of the number of times.
[0106] Optionally, the document usage information includes version information of the online document and the number of clients accessing the online document; The determination module 502 is specifically configured to: When the number of clients is greater than a preset number or the version information of the online document changes, the first time interval is determined as the time interval, the first time interval is greater than a second time interval, and the second time interval is the time interval for sending heartbeat requests when the online document is active in the client.
[0107] Optionally, the determining module 502 is specifically configured to: When the running state indicates that the online document is in an active state in the client, a second time interval is determined as the time interval, and the second time interval is smaller than a time interval for sending a heartbeat request when the online document is in an inactive state in the client.
[0108] The logic of the method executed by each functional module in the heartbeat control device 500 of the online document can refer to the part of the method related to the above embodiment, which will not be repeated here.
[0109] Figure 6 FIG. 1 is a schematic diagram of a heartbeat control device for an online document according to other embodiments. Figure 6 As shown, the embodiment of the present disclosure provides a heartbeat control device 600 for an online document, which is configured on a client and may include: The second sending module 601 is configured to send a heartbeat request for an online document to the server, wherein each heartbeat request sent by the client includes a running status of the online document in the client; A second receiving module 602 is configured to receive a time interval sent by the server, wherein the time interval is determined by the server according to the running state; The third sending module 603 is configured to send a heartbeat request for the online document to the server according to the time interval.
[0110] Optionally, the third sending module 603 is specifically configured as follows: In response to a change in the running state of the online document within the time interval, sending a heartbeat request for the online document to the server according to the changed running state of the online document; or In response to the running state of the online document not changing within the time interval, a heartbeat request for the online document is sent to the server when the time interval is reached.
[0111] Optionally, the third sending module 603 is specifically configured as follows: Determine a target time, where the target time is the time when the client last sent a heartbeat request including the same running state as the changed running state to the server; When the time interval between the current time and the target time reaches the time interval received last time that matches the changed running state, a heartbeat request including the changed running state is sent to the server.
[0112] The logic of the method executed by each functional module in the heartbeat control device 600 of the online document can refer to the part of the method related to the above embodiment, which will not be repeated here.
[0113] Reference below Figure 7 , which shows a schematic diagram of the structure of an electronic device (such as a client or a server) 700 suitable for implementing the embodiment of the present disclosure. The client in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0114] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0115] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0116] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 709, or installed from a storage device 708, or installed from a ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0117] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0118] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0119] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0120] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: receives a heartbeat request for an online document sent by a client, wherein each heartbeat request sent by the client includes the running status of the online document in the client; determines the time interval for the client to send a heartbeat request next time according to the running status; and sends the time interval to the client.
[0121] Alternatively, the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: sends a heartbeat request for an online document to a server, wherein each heartbeat request sent by the client includes the running status of the online document in the client; receives a time interval sent by the server, wherein the time interval is determined by the server according to the running status; and sends a heartbeat request for the online document to the server according to the time interval.
[0122] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, limit the module itself.
[0125] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0126] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0127] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0128] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0129] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. A heartbeat control method for an online document, characterized in that: Executed by the server, including: Receiving a heartbeat request for an online document sent by a client, wherein each heartbeat request sent by the client includes a running status of the online document in the client; Determine, according to the running status, the time interval for the client to send a heartbeat request next time; The time interval is sent to the client.
2. The method according to claim 1, characterized in that Determining, according to the running state, a time interval for the client to send a heartbeat request next time includes: When the running state indicates that the online document is in an inactive state in the client, the time interval is determined according to document usage information of the online document.
3. The method according to claim 2, characterized in that The document usage information includes version information of the online document and the number of clients accessing the online document; The determining the time interval according to the document usage information of the online document includes: When the number of clients is less than or equal to a preset number and the version information of the online document has not changed, the time interval is determined according to the number of times the server continuously receives heartbeat requests of a preset type, where the preset type of heartbeat request is a heartbeat request that indicates that the online document is in an inactive state in the client.
4. The method according to claim 2, characterized in that: The document usage information includes version information of the online document and the number of clients accessing the online document; The determining the time interval according to the document usage information of the online document includes: When the number of clients is greater than a preset number or the version information of the online document changes, the first time interval is determined as the time interval, the first time interval is greater than a second time interval, and the second time interval is the time interval for sending heartbeat requests when the online document is active in the client.
5. The method according to claim 1, characterized in that: Determining, according to the running state, a time interval for the client to send a heartbeat request next time includes: When the running state indicates that the online document is in an active state in the client, a second time interval is determined as the time interval, and the second time interval is smaller than a time interval for sending a heartbeat request when the online document is in an inactive state in the client.
6. A heartbeat control method for an online document, characterized in that: Executed by the client, including: Sending a heartbeat request for the online document to the server, wherein each heartbeat request sent by the client includes the running status of the online document in the client; receiving a time interval sent by the server, wherein the time interval is determined by the server according to the running state; A heartbeat request for the online document is sent to the server according to the time interval.
7. The method according to claim 6, characterized in that The sending a heartbeat request for the online document to the server according to the time interval includes: In response to a change in the running state of the online document within the time interval, sending a heartbeat request for the online document to the server according to the changed running state of the online document; or In response to the running state of the online document not changing within the time interval, a heartbeat request for the online document is sent to the server when the time interval is reached.
8. The method according to claim 7, characterized in that The sending a heartbeat request for the online document to the server according to the changed running state of the online document includes: Determine a target time, where the target time is the time when the client last sent a heartbeat request including the same running state as the changed running state to the server; When the time interval between the current time and the target time reaches the time interval received last time that matches the changed running state, a heartbeat request including the changed running state is sent to the server.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the computer program implements the steps of the method according to any one of claims 1 to 5, or implements the steps of the method according to any one of claims 6 to 8.
10. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, used to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 5, or to implement the steps of the method according to any one of claims 6 to 8.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 5, or implements the steps of the method according to any one of claims 6 to 8.