Information transmission method and system, electronic equipment and storage medium
By using Fibonacci sequence and dynamic polling frequency adjustment technology in real-time communication systems, the server burden and bandwidth waste caused by traditional polling mechanisms are solved, and more efficient information transmission and response speed are achieved.
Patent Information
- Application Number
- CN202411287138.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-03
AI Technical Summary
Traditional polling mechanisms lead to increased server burden and wasted bandwidth in instant messaging systems, and are unable to effectively deal with network latency and server load changes.
The polling time series is set using the Fibonacci sequence, the polling frequency is dynamically adjusted according to the working status of the server and the usage status of the client, and the polling interval and retry requests are extended when no response is received.
It reduces server burden and network traffic, improves the efficiency and response speed of information updates, balances information real-time and system resource usage, and solves the problem of delayed timeout due to network or server response during polling.
Smart Images

Figure CN119254731A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an information transmission method and system, an electronic device and a storage medium. Background Art
[0002] In the modern Internet environment, instant messaging has become a core tool for people's daily communication. In order to ensure the real-time delivery of messages, the instant messaging system widely adopts the polling mechanism, that is, the client sends a request to the server regularly to check whether there is a new message. However, in the traditional polling mechanism, frequent requests increase the burden on the server, resulting in a large waste of bandwidth resources. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0004] To this end, a first aspect of the present invention proposes a method for information transmission.
[0005] A second aspect of the present invention provides an information transmission system.
[0006] A third aspect of the present invention provides an electronic device.
[0007] A fourth aspect of the present invention provides a storage medium.
[0008] In view of this, according to a first aspect of the present invention, a method for information transmission is proposed, comprising: determining a polling time sequence, wherein the polling time sequence includes multiple moments sorted according to the Fibonacci sequence; when the time reaches a first moment, sending a first data request to a server to obtain required information, wherein the first moment is the first moment in the time sequence; based on receiving the first information sent by the server, redetermining the polling time sequence, wherein the first information corresponds to the first data request; based on not receiving the first information sent by the server, when the time reaches a second moment, resending the first data request to the server, wherein the second moment is the moment next to the first moment in the time sequence.
[0009] The information transmission method provided by the present invention mainly includes: first determining the time sequence of polling, wherein the time sequence of polling includes multiple sequentially arranged moments, and the sequence composed of the time intervals between the multiple moments is the Fibonacci sequence, that is, the time intervals between the multiple moments gradually increase, for example, the time interval between the first moment and the second moment is 1 second, then the time interval between the second moment and the third moment is 1 second, the time interval between the third moment and the fourth moment is 2 seconds, the time interval between the fourth moment and the fifth moment is 3 seconds, the time interval between the fifth moment and the sixth moment is 5 seconds, the time interval between the sixth moment and the seventh moment is 8 seconds, and so on, it can be found that the time interval in the time sequence of polling is set by using the Fibonacci sequence, and the interval time of the request can be gradually increased. In this way, frequent requests can be reduced, thereby reducing the burden on the server and network traffic. After determining the time sequence of polling, when the current time reaches the first moment, a first data request is sent to the server so that the client can obtain the required information, wherein the first moment is the first moment in the time sequence of polling. If the client receives the first information sent by the server, the polling time sequence is re-determined, wherein the first information corresponds to the first data request, that is, when the server sends the first information to the client in response to the first data request, it means that the polling cycle ends, and it is necessary to re-determine the next polling cycle, that is, the polling time sequence, wherein the Fibonacci sequence is still used to set the time interval between each moment in the time sequence when the polling time sequence is re-determined. If the client has not received the first information sent by the server in response to the first data request when the time reaches the second moment, the client re-sends the first data request to the server at the second moment, wherein the second moment is the moment next to the first moment in the time sequence, that is, when the time reaches the second moment and the first information sent by the server has not been received, the client re-sends the first data request, and further, if the first information sent by the server has not been received when the time reaches the fourth moment, the client re-sends the first data request again, wherein the fourth moment is the moment next to the second moment in the time sequence, and so on is repeated until the first information sent by the server is received. In the present invention, the Fibonacci sequence is used to set the polling time sequence, and the gradually increasing characteristic of the Fibonacci sequence is utilized to gradually increase the time interval between adjacent moments in the polling time sequence, thereby achieving the technical effect of gradually increasing the time interval for sending requests, thereby reducing the frequency of sending requests, reducing the burden on the server, and saving broadband resources.
[0010] The information transmission method according to the present invention may also have the following technical features: In some technical solutions, optionally, the step of determining the time sequence of polling includes: obtaining the working status of the server; and determining the time sequence of polling according to the working status of the server.
[0011] In the technical solution, the step of determining the time sequence of polling includes: first obtaining the working status of the server, wherein the working status of the server refers to the load quantity of the server and / or the network delay of the server. Then, the time sequence of polling is determined according to the working status of the server. When the working status is busy, the time intervals between multiple moments in the time sequence of polling are automatically increased. When the working status is idle, the time intervals between multiple moments in the time sequence of polling are restored to a shorter time interval. By adjusting the polling frequency according to the current working status of the server, the real-time nature of information update and the use of system resources can be effectively balanced.
[0012] In some technical schemes, optionally, the step of determining the polling time series according to the working status of the server includes: based on the working status being a first state, increasing the interval between adjacent moments in the polling time series, wherein the first state is that the load of the server is in an increasing state and / or the network delay of the server increases to a first preset threshold; based on the working status being in a second state, reducing the interval between adjacent moments in the polling time series, wherein the second state is that the load of the server is in a decreasing state and / or the network delay of the server is reduced to a second preset threshold, and the first preset threshold is greater than the second preset threshold.
[0013] In the technical scheme, the step of determining the time interval of polling according to the working state includes: when the working state is the first state, increasing the time interval between adjacent moments in the polling time series, wherein the first state is that the load quantity of the server increases and / or the network delay of the server increases to a first preset threshold, that is, when the load increase of the server and / or the network delay of the server is detected to be high, the interval between multiple moments in the polling time series is automatically increased. When the working state is the second state, reducing the time interval between adjacent moments in the polling time series, wherein the second state is that the load quantity of the server decreases and / or the network delay of the server decreases to a second preset threshold, and the first preset threshold is greater than the second preset threshold. That is, when it is detected that the load of the server decreases and / or the network delay of the server decreases, the time interval between adjacent moments in the polling time series is restored to a shorter time interval. By dynamically adjusting the time interval in the polling time series according to the load state of the server and / or the network delay of the server, the problem of poor allocation of system resources when the network delay is too large or the load of the server increases is solved.
[0014] In some technical solutions, optionally, after the step of redetermining the polling time sequence based on receiving the first information sent by the server, it includes: marking the first information in the server; when the time reaches a third moment, sending a second data request to the server to obtain the required information, wherein the third moment is the first moment in the redetermined polling time sequence, and the second data request includes an identifier, and the identifier corresponds to the marked first information; receiving the second information sent by the server, wherein the second information corresponds to the second data request, and the second information is information that is not marked in the server.
[0015] In the technical solution, after the step of re-determining the time sequence of the polling based on the first information sent by the server, the method includes: marking the first information in the server, and then sending a second data request to the server when the time reaches the third moment to obtain the required information, wherein the third moment is the first moment in the time sequence of the polling after the re-determination, and the second data request includes a marker, and the marker corresponds to the marked first information, that is, when the server receives the second data request, it will locate the first information sent before according to the marker. Then the server will determine the second information according to the first information, wherein the second information refers to the information that is not marked in the server, that is, the second information refers to the information after the first information in the server, and finally receive the second information sent by the server, wherein the second information corresponds to the second data request. That is to say, in the present invention, after the server sends information to the client, the server will mark the information, wherein the marking method can be a timestamp or a marker for recording the information. When the client sends the second data request to the server at the first moment in the time sequence of the polling after the re-determination, the second data request will include an identifier corresponding to the previous mark. The server determines the information that has been sent before based on the identifier, and then saves the information and only sends the information that has not been sent before. In the present invention, the server records the timestamp or identifier of the last information of each poll, and the client requests incremental data based on this information, so that only new information since the last poll is requested, avoiding requesting all information every time polling, effectively reducing the data transmission volume and processing burden, improving the efficiency of information update, and also solving the problem that the client requests too much data due to the large information polling range.
[0016] In some technical solutions, optionally, the step of determining the time series of polling includes: obtaining the usage status of the client; based on the usage status being an active state, reducing the interval between adjacent moments in the time series of polling, wherein the active state is a state when the user uses the client; based on the usage status being an inactive state, increasing the interval between adjacent moments in the time series of polling, wherein the inactive state is a state when the user does not use the client.
[0017] In this technical solution, the step of determining the time series of polling includes: obtaining the usage status of the client, wherein the usage status of the client can be understood as the user's request to use the client. When the usage status is active, that is, when the user uses the client, the interval between adjacent moments in the time series of polling is reduced, that is, a shorter time interval is maintained, so as to ensure that the information can reach the client from the server in time; when the usage status is inactive, that is, when the user does not use the client, the interval between adjacent moments in the time series of polling is increased, that is, the time interval is automatically increased, so as to reduce unnecessary network requests and resource consumption. In the present invention, the polling time interval is adjusted according to the user's dynamics, thereby solving the problem that the polling time interval cannot be automatically adjusted when the user is in an active state.
[0018] In some technical solutions, optionally, the step of determining the time series of polling includes: obtaining the priority of information, wherein the information corresponds to a first data request; when the priority of the information is the first priority, reducing the interval between adjacent moments in the time series of polling; when the priority of the information is not the first priority, increasing the interval between adjacent moments in the time series of polling.
[0019] In the technical solution, the step of determining the time sequence of polling includes: first determining the priority of information, wherein the information corresponds to the first data request, that is, first setting priorities for different types of information, and then determining the type of information required by the client, and then determining the priority of the required information. When the priority of the information is the first priority, the interval between adjacent moments in the time sequence of polling is reduced, that is, when the priority of the information is higher, a shorter polling time interval is used. When the priority of the information is not the first priority, the interval between adjacent moments in the time sequence of polling is increased, that is, when the priority of the information is lower, a longer polling time interval is used. In the present invention, different polling strategies are set according to the priority of the information, thereby improving the response speed and real-time performance of the system to key information. Important information can be processed with priority, and users can quickly receive key notifications, while the processing of ordinary information will not affect the overall performance of the system, thereby improving the overall user experience.
[0020] In some technical solutions, optionally, after the step of resending the first data request to the server when the time reaches the second moment in the time sequence based on the failure to receive the first information sent by the server, it also includes: if the first information sent by the server has not been received within a preset time period, increasing the moment in the polling time sequence according to the Fibonacci sequence, wherein the preset time period is the time interval between the first moment and the last moment in the polling time sequence; when the time reaches the newly added moment in the polling time sequence, resending the first data request to the server.
[0021] In the technical solution, after the step of resending the first data request to the server when the time reaches the second moment in the time sequence based on the failure to receive the first information sent by the server, it also includes: if the client has not received the first information sent by the server within the preset time period, the moment in the polling time sequence is increased according to the Fibonacci sequence. For example, when the number of moments in the original polling time sequence is 5, when the client has not received the first information sent by the server within the preset time period, the number of moments in the polling time sequence is increased to 6. Among them, the preset time period refers to the time interval between the first moment and the last moment in the polling time sequence. Finally, when the time reaches the newly added moment, the first data request is resent to the server. That is to say, a polling timeout and retry mechanism is added in the present invention. When the server response is not received after the polling timeout, the polling interval is automatically extended and a retry is performed. The present invention designs a timeout and retry mechanism to cope with network problems and server response delays, and solves the problem of timeout due to network or server response delays during the polling process.
[0022] According to a second aspect of the present invention, a system for information transmission is proposed, wherein the system for information transmission comprises: a first determination module, the first determination module is used to determine a time sequence of polling, wherein the time sequence of polling includes multiple moments sorted according to the Fibonacci sequence; a first sending module, the first sending module is used to send a first data request to a server when the time reaches a first moment to obtain required information, wherein the first moment is the first moment in the time sequence; a second determination module, the second determination module is used to redetermine the time sequence of polling based on receiving first information sent by the server, wherein the first information corresponds to the first data request; a second sending module, the second sending module is used to resend the first data request to the server when the time reaches a second moment based on not receiving the first information sent by the server, wherein the second moment is the moment next to the first moment in the time sequence.
[0023] The information transmission system provided by the present invention mainly includes: a first determination module, a first sending module, a second determination module and a second sending module. Among them, the first determination module needs to first determine the time sequence of polling, wherein the time sequence of polling includes multiple sequentially arranged moments, and the sequence composed of the time intervals between the multiple moments is the Fibonacci sequence, that is, the time intervals between the multiple moments gradually increase. For example, the time interval between the first moment and the second moment is 1 second, then the time interval between the second moment and the third moment is 1 second, the time interval between the third moment and the fourth moment is 2 seconds, the time interval between the fourth moment and the fifth moment is 3 seconds, the time interval between the fifth moment and the sixth moment is 5 seconds, and the time interval between the sixth moment and the seventh moment is 8 seconds. By analogy, it can be found that the time interval in the polling time sequence is set by using the Fibonacci sequence, and the interval time of the request can be gradually increased. In this way, frequent requests can be reduced, thereby reducing the burden on the server and network traffic. After determining the polling time sequence, when the current time reaches the first moment, the first sending module sends a first data request to the server so that the client can obtain the required information, wherein the first moment is the first moment in the polling time sequence. If the client receives the first information sent by the server, the second determination module re-determines the polling time sequence, wherein the first information corresponds to the first data request, that is, when the server sends the first information to the client in response to the first data request, it means that the polling cycle ends, and it is necessary to re-determine the next polling cycle, i.e., the polling time sequence, wherein when re-determining the polling time sequence, the Fibonacci sequence is still used to set the time interval between each moment in the time sequence. If the client has not received the first information sent by the server in response to the first data request when the time reaches the second moment, the second sending module re-sends the first data request to the server at the second moment, wherein the second moment is the moment located next to the first moment in the time sequence, that is, when the time reaches the second moment and the first information sent by the server has not been received, the client re-sends the first data request, further, if the time reaches the fourth moment and the first information sent by the server has not been received, the client re-sends the first data request again, wherein the fourth moment is the moment located next to the second moment in the time sequence, and so on is repeated until the first information sent by the server is received. In the present invention, the polling time sequence is set by adopting the Fibonacci sequence, and the Fibonacci sequence has the characteristic of gradually increasing, and the time interval between adjacent moments in the polling time sequence is gradually increased, so as to achieve the technical effect of gradually increasing the time interval for sending requests, thereby reducing the frequency of sending requests, reducing the burden on the server, and saving broadband resources.
[0024] According to a third aspect of the present invention, an electronic device is proposed, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned information transmission methods when executing the computer program.
[0025] The electronic device provided by the present invention, in which the processor implements the steps of the above-mentioned information transmission method when executing a computer program, can achieve the technical effect of any of the above-mentioned technical solutions, and will not be repeated here.
[0026] According to a fourth aspect of the present invention, a storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above-mentioned information transmission methods are implemented.
[0027] The storage medium provided by the present invention and the steps of implementing the above-mentioned information transmission method when the computer program is executed by the processor can achieve the technical effects of any of the above-mentioned technical solutions, which will not be repeated here.
[0028] Additional aspects and advantages of the present invention will become apparent from the following description or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which: Figure 1 A schematic flow chart showing a method for information transmission according to an embodiment of the present invention; Figure 2 One of the flowchart diagrams showing the step of determining the time sequence of polling in the method for information transmission according to one embodiment of the present invention; Figure 3 A schematic flow chart showing a step of determining a time sequence of polling according to a working state of a server in an information transmission method according to an embodiment of the present invention; Figure 4 A schematic diagram showing a flow chart after the step of re-determining the time sequence of polling based on receiving first information sent by a server in a method for information transmission according to an embodiment of the present invention; Figure 5 A second flow chart showing the step of determining the time sequence of polling in the information transmission method according to an embodiment of the present invention; Figure 6 A third flowchart diagram showing the step of determining the time sequence of polling in the method for information transmission according to an embodiment of the present invention; Figure 7A flow chart showing a method for information transmission according to an embodiment of the present invention after the step of resending a first data request to a server when the time reaches a second moment in a time sequence based on failure to receive first information sent by the server; Figure 8 A schematic block diagram of a system for information transmission according to an embodiment of the present invention is shown; Fig. 9 A schematic block diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0030] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0032] Figure 1 A schematic flow chart of a method for information transmission according to an embodiment of the present invention is shown. The method includes: Step 102: determining a polling time sequence, wherein the polling time sequence includes a plurality of moments sorted according to the Fibonacci sequence; Step 104: When the time reaches the first moment, a first data request is sent to the server to obtain required information, wherein the first moment is the first moment in the time series; Step 106: re-determining the polling time sequence based on the first information received from the server, wherein the first information corresponds to the first data request; Step 108: Based on not receiving the first information sent by the server, when the time reaches a second moment, resend the first data request to the server, wherein the second moment is the moment that is next to the first moment in the time sequence.
[0033] The information transmission method provided by the present invention mainly includes: first determining the time sequence of polling, wherein the time sequence of polling includes multiple sequentially arranged moments, and the sequence composed of the time intervals between the multiple moments is the Fibonacci sequence, that is, the time intervals between the multiple moments gradually increase, for example, the time interval between the first moment and the second moment is 1 second, then the time interval between the second moment and the third moment is 1 second, the time interval between the third moment and the fourth moment is 2 seconds, the time interval between the fourth moment and the fifth moment is 3 seconds, the time interval between the fifth moment and the sixth moment is 5 seconds, the time interval between the sixth moment and the seventh moment is 8 seconds, and so on, it can be found that the time interval in the time sequence of polling is set by using the Fibonacci sequence, and the interval time of the request can be gradually increased. In this way, frequent requests can be reduced, thereby reducing the burden on the server and network traffic. After determining the time sequence of polling, when the current time reaches the first moment, a first data request is sent to the server so that the client can obtain the required information, wherein the first moment is the first moment in the time sequence of polling. If the client receives the first information sent by the server, the polling time sequence is re-determined, wherein the first information corresponds to the first data request, that is, when the server sends the first information to the client in response to the first data request, it means that the polling cycle ends, and it is necessary to re-determine the next polling cycle, that is, the polling time sequence, wherein the Fibonacci sequence is still used to set the time interval between each moment in the time sequence when the polling time sequence is re-determined. If the client has not received the first information sent by the server in response to the first data request when the time reaches the second moment, the client re-sends the first data request to the server at the second moment, wherein the second moment is the moment next to the first moment in the time sequence, that is, when the time reaches the second moment and the first information sent by the server has not been received, the client re-sends the first data request, and further, if the first information sent by the server has not been received when the time reaches the fourth moment, the client re-sends the first data request again, wherein the fourth moment is the moment next to the second moment in the time sequence, and so on is repeated until the first information sent by the server is received. In the present invention, the Fibonacci sequence is used to set the polling time sequence, and the gradually increasing characteristic of the Fibonacci sequence is utilized to gradually increase the time interval between adjacent moments in the polling time sequence, thereby achieving the technical effect of gradually increasing the time interval for sending requests, thereby reducing the frequency of sending requests, reducing the burden on the server, and saving broadband resources.
[0034] Figure 2One of the flowchart diagrams of the step of determining the time sequence of polling in the method for information transmission according to an embodiment of the present invention is shown; wherein the step of determining the time sequence of polling includes: Step 202: Obtain the working status of the server; Step 204: Determine the polling time sequence according to the working status of the server.
[0035] In this embodiment, the step of determining the time sequence of polling includes: first obtaining the working status of the server, wherein the working status of the server refers to the load quantity of the server and / or the network delay of the server. Then determining the time sequence of polling according to the working status of the server, when the working status is busy, automatically increasing the time intervals between multiple moments in the time sequence of polling, and when the working status is idle, restoring the time intervals between multiple moments in the time sequence of polling to a shorter time interval. By adjusting the polling frequency according to the current working status of the server, the real-time nature of information update and the use of system resources can be effectively balanced.
[0036] Figure 3 A schematic flow chart of determining a time sequence of polling according to a working state of a server in a method for information transmission according to an embodiment of the present invention is shown; wherein the time sequence of polling according to a working state of a server is determined, including: Step 302: when the working state is a first state, increasing the interval between adjacent moments in the polling time series, wherein the first state is that the load of the server is in an increasing state and / or the network delay of the server increases to a first preset threshold; Step 304: Based on the working state being in a second state, the interval between adjacent moments in the polling time series is reduced, wherein the second state is that the load of the server is in a reduced state and / or the network delay of the server is reduced to a second preset threshold, and the first preset threshold is greater than the second preset threshold.
[0037] In this embodiment, the step of determining the time interval of polling according to the working state includes: when the working state is the first state, increasing the time interval between adjacent moments in the polling time series, wherein the first state is that the load quantity of the server increases and / or the network delay of the server increases to a first preset threshold, that is, when the load increase of the server and / or the network delay of the server is detected to be high, the interval between multiple moments in the polling time series is automatically increased. When the working state is the second state, reducing the time interval between adjacent moments in the polling time series, wherein the second state is that the load quantity of the server decreases and / or the network delay of the server decreases to a second preset threshold, and the first preset threshold is greater than the second preset threshold. That is, when it is detected that the load of the server decreases and / or the network delay of the server decreases, the time interval between adjacent moments in the polling time series is restored to a shorter time interval. By dynamically adjusting the time interval in the polling time series according to the load state of the server and / or the network delay of the server, the problem of poor allocation of system resources when the network delay is too large or the load of the server increases is solved.
[0038] Figure 4 A flow chart of a method for information transmission according to an embodiment of the present invention is shown after the step of re-determining the time sequence of polling based on first information sent by a server is received; wherein, after the step of re-determining the time sequence of polling based on first information sent by a server is received, the method includes: Step 402: marking the first information in the server; Step 404: When the time reaches the third moment, send a second data request to the server to obtain the required information, wherein the third moment is the first moment in the re-determined polling time sequence, and the second data request includes an identifier, and the identifier corresponds to the marked first information; Step 406: Receive second information sent by the server, wherein the second information corresponds to the second data request and is information that is not marked in the server.
[0039] In this embodiment, after the step of re-determining the time sequence of the polling based on the first information sent by the server, the method includes: marking the first information in the server, and then sending a second data request to the server when the time reaches the third moment to obtain the required information, wherein the third moment is the first moment in the time sequence of the polling after the re-determination, and the second data request includes a marker, and the marker corresponds to the marked first information, that is, when the server receives the second data request, it will locate the first information sent before according to the marker. Then the server will determine the second information according to the first information, wherein the second information refers to the information that is not marked in the server, that is, the second information refers to the information after the first information in the server, and finally receive the second information sent by the server, wherein the second information corresponds to the second data request. That is to say, in the present invention, after the server sends information to the client, the server will mark the information, wherein the marking method can be a timestamp or a marker for recording the information. When the client sends the second data request to the server at the first moment in the time sequence of the polling after the re-determination, the second data request will include an identifier corresponding to the previous mark. The server determines the information that has been sent before based on the identifier, and then saves the information and only sends the information that has not been sent before. In the present invention, the server records the timestamp or identifier of the last information of each poll, and the client requests incremental data based on this information, so that only new information since the last poll is requested, avoiding requesting all information every time polling, effectively reducing the data transmission volume and processing burden, improving the efficiency of information update, and also solving the problem that the client requests too much data due to the large information polling range.
[0040] Figure 5 A second flow chart of the step of determining the time sequence of polling in the method for information transmission according to an embodiment of the present invention is shown; wherein the step of determining the time sequence of polling includes: Step 502: Obtain the usage status of the client; Step 504: when the usage state is an active state, reducing the interval between adjacent moments in the polling time series, wherein the active state is a state when the user uses the client; Step 506: when the usage status is an inactive status, increase the interval between adjacent moments in the polling time series, wherein the inactive status is a status when the user is not using the client.
[0041] In this embodiment, the step of determining the time series of polling includes: obtaining the usage status of the client, wherein the usage status of the client can be understood as the user's request to use the client. When the usage status is active, that is, when the user uses the client, the interval between adjacent moments in the time series of polling is reduced, that is, a shorter time interval is maintained, thereby ensuring that information can reach the client from the server in a timely manner; when the usage status is inactive, that is, when the user does not use the client, the interval between adjacent moments in the time series of polling is increased, that is, the time interval is automatically increased, thereby reducing unnecessary network requests and resource consumption. In the present invention, the polling time interval is adjusted dynamically according to the user, thereby solving the problem that the polling time interval cannot be automatically adjusted when the user is in an active state.
[0042] Figure 6 The third flow chart of the step of determining the time sequence of polling in the method for information transmission according to an embodiment of the present invention is shown; wherein the step of determining the time sequence of polling includes: Step 602: Obtaining a priority level of information, wherein the information corresponds to a first data request; Step 604: when the priority of the information is the first priority, reducing the interval between adjacent moments in the polling time series; Step 606: When the priority of the information is not the first priority, increase the interval between adjacent moments in the polling time series.
[0043] In this embodiment, the step of determining the time sequence of polling includes: first determining the priority of information, wherein the information corresponds to the first data request, that is, first setting the priority of different types of information, and then determining the type of information required by the client, and then determining the priority of the required information. When the priority of the information is the first priority, the interval between adjacent moments in the time sequence of polling is reduced, that is, when the priority of the information is higher, a shorter polling time interval is used. When the priority of the information is not the first priority, the interval between adjacent moments in the time sequence of polling is increased, that is, when the priority of the information is lower, a longer polling time interval is used. In the present invention, different polling strategies are set according to the priority of the information, thereby improving the response speed and real-time performance of the system to key information. Important information can be processed with priority, and users can quickly receive key notifications, while the processing of ordinary information will not affect the overall performance of the system, thereby improving the overall user experience.
[0044] Figure 7A flow chart of a method for information transmission according to an embodiment of the present invention is shown after the step of resending a first data request to a server when the time reaches a second moment based on the failure to receive the first information sent by the server; wherein, after the step of resending the first data request to the server when the time reaches the second moment based on the failure to receive the first information sent by the server, the method for information transmission includes: Step 702: if the first information sent by the server has not been received within the preset time period, the time in the polling time series is increased according to the Fibonacci sequence, wherein the preset time period is the time interval between the first time and the last time in the polling time series; Step 704: When the time reaches the newly added moment in the polling time sequence, resend the first data request to the server.
[0045] In this embodiment, after the step of resending the first data request to the server when the time reaches the second moment in the time sequence based on the failure to receive the first information sent by the server, the method further includes: if the client has not received the first information sent by the server within the preset time period, the moment in the polling time sequence is increased according to the Fibonacci sequence. For example, when the number of moments in the original polling time sequence is 5, when the client has not received the first information sent by the server within the preset time period, the number of moments in the polling time sequence is increased to 6. Among them, the preset time period refers to the time interval between the first moment and the last moment in the polling time sequence. Finally, when the time reaches the newly added moment, the first data request is resent to the server. That is to say, a polling timeout and retry mechanism is added in the present invention. When the server response is not received after the polling timeout, the polling interval is automatically extended and a retry is performed. The present invention designs a timeout and retry mechanism to cope with network problems and server response delays, and solves the problem of timeout due to network or server response delays during the polling process.
[0046] Figure 8 A schematic block diagram of an information transmission system according to an embodiment of the present invention is shown; wherein the information transmission system 80 comprises: A first determining module 802 is used to determine a polling time sequence, wherein the polling time sequence includes a plurality of moments sorted according to the Fibonacci sequence; A first sending module 804 sends a first data request to a server to obtain required information when the time reaches a first moment, wherein the first moment is the first moment in the time series; A second determination module 806, configured to re-determine a polling time sequence based on first information received from the server, wherein the first information corresponds to the first data request; The second sending module 808 is used to resend the first data request to the server when the time reaches a second moment based on not receiving the first information sent by the server, wherein the second moment is the moment next to the first moment in the time sequence.
[0047] The information transmission system 80 provided by the present invention mainly includes: a first determination module 802, a first sending module 804, a second determination module 806 and a second sending module 808. Among them, the first determination module 802 needs to first determine the time sequence of the polling, wherein the time sequence of the polling includes multiple sequentially arranged moments, and the sequence composed of the time intervals between the multiple moments is the Fibonacci sequence, that is, the time intervals between the multiple moments gradually increase. For example, the time interval between the first moment and the second moment is 1 second, then the time interval between the second moment and the third moment is 1 second, the time interval between the third moment and the fourth moment is 2 seconds, the time interval between the fourth moment and the fifth moment is 3 seconds, the time interval between the fifth moment and the sixth moment is 5 seconds, and the time interval between the sixth moment and the seventh moment is 8 seconds. By analogy, it can be found that the time interval in the polling time sequence is set by using the Fibonacci sequence, and the interval time of the request can be gradually increased. In this way, frequent requests can be reduced, thereby reducing the burden on the server and network traffic. After determining the polling time sequence, when the current time reaches the first moment, the first sending module 804 sends a first data request to the server so that the client can obtain the required information, wherein the first moment is the first moment in the polling time sequence. If the client receives the first information sent by the server, the second determining module 806 re-determines the polling time sequence, wherein the first information corresponds to the first data request, that is, when the server sends the first information to the client in response to the first data request, it means that the polling cycle ends, and it is necessary to re-determine the next polling cycle, i.e., the polling time sequence, wherein when re-determining the polling time sequence, the Fibonacci sequence is still used to set the time interval between each moment in the time sequence. If the client has not received the first information sent by the server in response to the first data request when the time reaches the second moment, the second sending module 808 re-sends the first data request to the server at the second moment, wherein the second moment is the moment located next to the first moment in the time sequence, that is, when the time reaches the second moment and the first information sent by the server has not been received, the client re-sends the first data request, further, if the time reaches the fourth moment and the first information sent by the server has not been received, the client re-sends the first data request again, wherein the fourth moment is the moment located next to the second moment in the time sequence, and so on is repeated until the first information sent by the server is received. In the present invention, by using the Fibonacci sequence to set the polling time sequence, the Fibonacci sequence has the characteristic of gradually increasing, and the time interval between adjacent moments in the polling time sequence is gradually increased, so as to achieve the technical effect of gradually increasing the time interval for sending requests, thereby reducing the frequency of sending requests, reducing the burden on the server, and saving broadband resources.
[0048] In some embodiments, optionally, the first determination module 802 is used to obtain the working status of the server; and determine the time sequence of polling according to the working status of the server.
[0049] In this embodiment, the first determination module 802 is used to first obtain the working status of the server, wherein the working status of the server refers to the load quantity of the server and / or the network delay of the server. Then, the time sequence of polling is determined according to the working status of the server. When the working status is busy, the time intervals between multiple moments in the time sequence of polling are automatically increased. When the working status is idle, the time intervals between multiple moments in the time sequence of polling are restored to a shorter time interval. By adjusting the polling frequency according to the current working status of the server, the real-time nature of information update and the use of system resources can be effectively balanced.
[0050] In some embodiments, optionally, the first determination module 802 is mainly used to increase the interval between adjacent moments in the polling time series based on when the working state is a first state, wherein the first state is that the load of the server is in an increasing state and / or the network delay of the server increases to a first preset threshold; and to reduce the interval between adjacent moments in the polling time series based on when the working state is in a second state, wherein the second state is that the load of the server is in a decreasing state and / or the network delay of the server is reduced to a second preset threshold, and the first preset threshold is greater than the second preset threshold.
[0051] In this embodiment, the first determination module 802 is mainly used to increase the time interval between adjacent moments in the polling time series when the working state is the first state, wherein the first state is that the load quantity of the server increases and / or the network delay of the server rises to the first preset threshold value, that is, when the load increase of the server and / or the network delay of the server is detected to be high, the interval between multiple moments in the polling time series is automatically increased. When the working state is the second state, the time interval between adjacent moments in the polling time series is reduced, wherein the second state is that the load quantity of the server decreases and / or the network delay of the server decreases to the second preset threshold value, and the first preset threshold value is greater than the second preset threshold value. That is, when it is detected that the load of the server decreases and / or the network delay of the server decreases, the time interval between adjacent moments in the polling time series is restored to a shorter time interval. By dynamically adjusting the time interval in the polling time series according to the load state of the server and / or the network delay of the server, the problem of poor allocation of system resources when the network delay is too large or the load of the server increases is solved.
[0052] In some embodiments, optionally, the information transmission system 80 also includes: a marking module, used to mark the first information in the server; a third sending module, used to send a second data request to the server when the time reaches a third moment to obtain the required information, wherein the third moment is the first moment in the redetermined polling time sequence, and the second data request includes an identifier, and the identifier corresponds to the marked first information; a first receiving module, used to receive the second information sent by the server, wherein the second information corresponds to the second data request, and the second information is information that is not marked in the server.
[0053] In this embodiment, the information transmission system 80 also includes: a marking module, a third sending module and a first receiving module. The marking module can mark the first information in the server, and then when the time reaches the third moment, the third sending module sends a second data request to the server to obtain the required information, wherein the third moment is the first moment in the time sequence of the re-determined polling, and the second data request includes a marker, and the marker corresponds to the marked first information, that is, when the server receives the second data request, it will locate the first information sent before according to the marker. Then the server will determine the second information according to the first information, wherein the second information refers to the information that is not marked in the server, that is, the second information refers to the information after the first information in the server, and finally the first receiving module receives the second information sent by the server, wherein the second information corresponds to the second data request. That is to say, in the present invention, after the server sends information to the client, the server will mark the information, wherein the marking method can be a timestamp or a marker for recording the information. When the client sends the second data request to the server at the first moment in the time sequence of the re-determined polling, the second data request will include an identifier corresponding to the previous mark. The server determines the information that has been sent before based on the identifier, and then saves the information and only sends the information that has not been sent before. In the present invention, the server records the timestamp or identifier of the last information of each poll, and the client requests incremental data based on this information, so that only new information since the last poll is requested, avoiding requesting all information every time polling, effectively reducing the data transmission volume and processing burden, improving the efficiency of information update, and also solving the problem that the client requests too much data due to the large information polling range.
[0054] In some embodiments, optionally, the first determination module 802 is also used to obtain the usage status of the client; based on the usage status being an active state, the interval between adjacent moments in the polling time series is reduced, wherein the active state is the state when the user uses the client; based on the usage status being an inactive state, the interval between adjacent moments in the polling time series is increased, wherein the inactive state is the state when the user is not using the client.
[0055] In this embodiment, the first determination module 802 is also used to obtain the usage status of the client, wherein the usage status of the client can be understood as the user's request for the client. When the usage status is active, that is, when the user uses the client, the interval between adjacent moments in the polling time series is reduced, that is, a shorter time interval is maintained, thereby ensuring that the information can reach the client from the server in time; when the usage status is inactive, that is, when the user does not use the client, the interval between adjacent moments in the polling time series is increased, that is, the time interval is automatically increased, thereby reducing unnecessary network requests and resource consumption. In the present invention, the polling time interval is adjusted according to the user's dynamics, thereby solving the problem that the polling time interval cannot be automatically adjusted when the user is in an active state.
[0056] In some embodiments, optionally, the first determination module 802 is also used to obtain the priority of information, where the information corresponds to the first data request; when the priority of the information is the first priority, the interval between adjacent moments in the polling time series is reduced; when the priority of the information is not the first priority, the interval between adjacent moments in the polling time series is increased.
[0057] In this embodiment, the first determination module 802 is also used to first determine the priority of the information, wherein the information corresponds to the first data request, that is, firstly set the priority of different types of information, and then determine the type of information required by the client, and then determine the priority of the required information. When the priority of the information is the first priority, the interval between adjacent moments in the time series of the polling is reduced, that is, when the priority of the information is higher, a shorter time interval of the polling is used. When the priority of the information is not the first priority, the interval between adjacent moments in the time series of the polling is increased, that is, when the priority of the information is lower, a longer time interval of the polling is used. In the present invention, different polling strategies are set according to the priority of the information, thereby improving the response speed and real-time performance of the system to key information. Important information can be processed with priority, and users can quickly receive key notifications, while the processing of ordinary information will not affect the overall performance of the system, thereby improving the overall user experience.
[0058] In some embodiments, optionally, the information transmission system 80 also includes: a new adding module, used to increase the moment in the polling time series according to the Fibonacci sequence if the first information sent by the server has not been received within a preset time period, wherein the preset time period is the time interval between the first moment and the last moment in the polling time series; and a fourth sending module, used to resend the first data request to the server when the time reaches the newly added moment in the polling time series.
[0059] In this embodiment, the information transmission system 80 also includes: a new module and a fourth sending module. Among them, if the client has not received the first information sent by the server within the preset time period, the new module increases the moment in the polling time series according to the Fibonacci sequence. For example, when the number of moments in the original polling time series is 5, when the client has not received the first information sent by the server within the preset time period, the number of moments in the polling time series is increased to 6. Among them, the preset time period refers to the time interval between the first moment and the last moment in the polling time series. Finally, when the time reaches the newly added moment, the fourth sending module re-sends the first data request to the server. That is to say, a polling timeout and retry mechanism is added in the present invention. When the polling timeout does not receive the server response, the polling interval is automatically extended and a retry is performed. The present invention designs a timeout and retry mechanism to cope with network problems and server response delays, and solves the problem of timeout due to network or server response delays during the polling process.
[0060] Fig. 9 A schematic block diagram of an electronic device of an embodiment of the present invention is shown; wherein the electronic device 90 includes a memory 902, a processor 904, and a computer program stored in the memory 902 and executable on the processor 904, and when the processor 904 executes the computer program, the steps of the method for information transmission as described above are implemented.
[0061] The electronic device 90 provided by the present invention, in which the processor 904 implements the steps of the above-mentioned information transmission method when executing a computer program, can achieve the technical effect of any of the above-mentioned embodiments, and will not be described in detail.
[0062] An embodiment of the present invention provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned information transmission methods are implemented.
[0063] The storage medium provided by the present invention and the steps of implementing the above-mentioned information transmission method when the computer program is executed by the processor can achieve the technical effects of any of the above-mentioned embodiments and will not be described in detail.
[0064] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance unless otherwise clearly specified and limited; the terms "connection", "installation", "fixation" and the like should be understood in a broad sense, for example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0065] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0066] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for information transmission, characterized in that: include: Determine a polling time sequence, wherein the polling time sequence includes a plurality of moments sorted according to the Fibonacci sequence; When the time reaches a first moment, sending a first data request to the server to obtain required information, wherein the first moment is the first moment in the time series; re-determining the time sequence of the polling based on receiving first information sent by the server, wherein the first information corresponds to the first data request; Based on not receiving the first information sent by the server, when the time reaches a second moment, the first data request is resent to the server, wherein the second moment is the moment next to the first moment in the time sequence.
2. The method for information transmission according to claim 1, characterized in that: The step of determining the time sequence of polling includes: Obtaining the working status of the server; The time sequence of the polling is determined according to the working status of the server.
3. The method for information transmission according to claim 2, characterized in that: The step of determining the time sequence of the polling according to the working status of the server comprises: When the working state is a first state, increasing the interval between adjacent moments in the polling time series, wherein the first state is that the load of the server is in an increasing state and / or the network delay of the server increases to a first preset threshold; Based on the working state being in a second state, the interval between adjacent moments in the polling time series is reduced, wherein the second state is that the load of the server is in a reduced state and / or the network delay of the server is reduced to a second preset threshold, and the first preset threshold is greater than the second preset threshold.
4. The method for information transmission according to claim 1, characterized in that: After the step of re-determining the time sequence of the polling based on receiving the first information sent by the server, the method for information transmission further includes: marking the first information in the server; When the time reaches a third moment, sending a second data request to the server to obtain the required information, wherein the third moment is the first moment in the re-determined polling time sequence, and the second data request includes an identifier, and the identifier corresponds to the marked first information; Receive second information sent by the server, wherein the second information corresponds to the second data request and is information that is not marked in the server.
5. The method for information transmission according to claim 1, characterized in that: The step of determining the time sequence of polling includes: Get the usage status of the client; When the usage state is an active state, reducing the interval between adjacent moments in the polling time series, wherein the active state is a state when the user uses the client; When the usage status is an inactive status, the interval between adjacent moments in the polling time series is increased, wherein the inactive status is a status when the user does not use the client.
6. The method for information transmission according to claim 1, characterized in that: The step of determining the time sequence of polling includes: obtaining a priority of information, wherein the information corresponds to the first data request; When the priority of the information is the first priority, reducing the interval between adjacent moments in the polling time series; When the priority of the information is not the first priority, the interval between adjacent moments in the polling time series is increased.
7. The method for information transmission according to any one of claims 1 to 6, characterized in that: After the step of resending the first data request to the server when the time reaches the second moment based on not receiving the first information sent by the server, the method for information transmission further includes: If the first information sent by the server has not been received within a preset time period, the time in the polling time series is increased according to the Fibonacci sequence; wherein the preset time period is the time interval between the first time and the last time in the polling time series; When the time reaches the newly added moment in the polling time series, the first data request is resent to the server.
8. A system for information transmission, characterized in that: include: A first determining module, the first determining module is used to determine a polling time sequence, wherein the polling time sequence includes a plurality of moments sorted according to a Fibonacci sequence; A first sending module, the first sending module is used to send a first data request to the server to obtain required information when the time reaches a first moment, wherein the first moment is the first moment in the time series; a second determining module, the second determining module being configured to re-determine the time sequence of the polling based on first information received from the server, wherein the first information corresponds to the first data request; A second sending module, the second sending module is used to resend the first data request to the server when the time reaches a second moment based on not receiving the first information sent by the server, wherein the second moment is the moment next to the first moment in the time sequence.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the information transmission method according to any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the information transmission method according to any one of claims 1 to 7 are implemented.
