CN116828022B - Method, device, equipment and medium for managing connection relation with server - Google Patents

Method, device, equipment and medium for managing connection relation with server Download PDF

Info

Publication number
CN116828022B
CN116828022B CN202311107773.5A CN202311107773A CN116828022B CN 116828022 B CN116828022 B CN 116828022B CN 202311107773 A CN202311107773 A CN 202311107773A CN 116828022 B CN116828022 B CN 116828022B
Authority
CN
China
Prior art keywords
server
connection
request
data
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311107773.5A
Other languages
Chinese (zh)
Other versions
CN116828022A (en
Inventor
于志杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Bailong Mayun Technology Co ltd
Original Assignee
Beijing Bailong Mayun Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Bailong Mayun Technology Co ltd filed Critical Beijing Bailong Mayun Technology Co ltd
Priority to CN202311107773.5A priority Critical patent/CN116828022B/en
Publication of CN116828022A publication Critical patent/CN116828022A/en
Application granted granted Critical
Publication of CN116828022B publication Critical patent/CN116828022B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present application relates to a method, apparatus, computer device, and storage medium for managing a connection relationship with a server. The method comprises the following steps: responding to the received connection instruction, and establishing a connection relation with the server through a preset connection interface; executing connection management logic according to the target calling frequency to manage the connection relation; the connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic; the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server. The embodiment of the application can keep a long-time connection relation with the server to meet the communication requirement, simultaneously can enable the server to return data in time, and can ensure that the returned data are useful and the sequence is not disordered.

Description

Method, device, equipment and medium for managing connection relation with server
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a computer device, and a storage medium for managing a connection relationship with a server.
Background
When a website is used, a long time connection with a server is needed in some scenes, such as chat rooms, message notification, personal message reminding, log printing, deployment flow and the like, in the scenes, a client needs to communicate with the server for a long time to acquire a message, and the current modes for realizing the requirement mainly include polling, long link (websocket), flash shock and the like. Although common, the above methods have various disadvantages and cannot be applied to various scenes. In some specific scenarios, for example, a scenario where a client needs to stay connected to a server for a long time and the data amount is large, none of the above methods is applicable, and the original drawbacks may be amplified when the client is used in the scenario. Specifically, polling sets a timer and accesses the server once at intervals, which has the disadvantage that the message returned by the server is repeated, and the message carries a large amount of useless information, thereby wasting broadband resources; the long polling is that after the client accesses the server, the server stops returning, and returns information after the client has the message, and the disadvantage is that the operation consumes the connection resource of the server and the returning sequence of the message cannot be ensured; long links (websokets), which can stay connected to the server for a long time, however, the long-time occupation of server resources causes the server to become more stressed; for flash cache, this approach can truly implement instant messaging, but has the disadvantage that the client is required to download the plug-in, cannot support hypertext transfer protocol (Hypertext Transfer Protocol, HTTP) and cannot automatically traverse the firewall.
Disclosure of Invention
The application aims at the defects or shortcomings and provides a method, a device, computer equipment and a storage medium for managing the connection relation with a server.
The present application provides, according to a first aspect, a method of managing a connection relationship with a server, the method being applied to a client in some embodiments, the method comprising:
responding to the received connection instruction, and establishing a connection relation with the server through a preset connection interface;
executing connection management logic according to the target calling frequency to manage the connection relation;
the connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic;
the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server.
In some embodiments, the target call frequency is a fixed frequency that is preset, or a dynamic frequency that is determined according to the amount of access corresponding to the current time period.
In some embodiments, the connection management logic further comprises, in response to not receiving the response information of the server to the first request, or the response information of the server to the first request indicates a failure in the response, sending the first request again to the server after a preset period of time.
In some embodiments, when the response information includes the identification information, the response information further includes indication information for indicating whether the task connected at this time is completed;
the connection management logic further includes disconnecting the connection relationship from the server in response to the indication information indicating that the task of the current connection is completed.
In some embodiments, the information carried by the first request includes status information indicating whether a call needs to be continued thereafter;
disconnecting the connection from the server, comprising:
and sending state information carrying with the indication that the call is not required to be continued after the state information is sent to the server so as to indicate the disconnection relationship of the server.
In some embodiments, the connection management logic further includes, in response to the indication that the task indicating the current connection is not complete, carrying state information indicating that the call needs to be continued after the next first request sent to the server, to indicate that the server continues to maintain the connection relationship.
In some embodiments, the data request logic specifically includes taking an incremental portion of the identification information as a call-in data interface to send a second request to the server, the second request being for requesting resource data corresponding to the incremental portion;
in some embodiments, the data request logic further comprises: the resource data requested from the server is ordered according to the identification information.
The present application provides, according to a second aspect, an apparatus for managing a connection relationship with a server, the apparatus being applied to a client in some embodiments, the apparatus comprising:
the connection establishment module is used for establishing a connection relation with the server through a preset connection interface in response to receiving the connection instruction;
the connection management module is used for executing connection management logic according to the target calling frequency so as to manage the connection relation;
the connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic;
the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server.
According to a third aspect, the present application provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the computer program to perform the steps of the method of managing a connection relationship with a server provided in any of the embodiments described above.
The present application according to a fourth aspect provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of managing a connection relationship with a server provided in any of the above embodiments.
In the above embodiment of the present application, the client establishes a connection relationship with the server through a preset connection interface in response to receiving the connection instruction; executing connection management logic according to the target calling frequency to manage the connection relation; the connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic; the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server. The operation of establishing connection and the operation of requesting data are not separated in the conventional technical scheme, but the above embodiment of the present application separates the operation of establishing connection from the operation of requesting data, specifically, two interfaces, namely, a connection interface and a data interface, are adopted, a connection relationship is established with a server through the connection interface and the connection relationship is managed, and related data is requested from the server through the data interface, so that the connection relationship with the server for a long time can be maintained to meet the communication requirement, meanwhile, the server can also return data in time, the returned data can be ensured to be useful and the sequence can not be disordered, and finally, the effects of effectively utilizing broadband resources and avoiding occupying server resources for a long time (reducing the pressure of the server) can be realized while meeting the communication requirement.
Drawings
FIG. 1 is a diagram of an application environment for a method of managing connection relationships with servers in accordance with one or more embodiments of the present application;
FIG. 2 is a flow diagram of a method of managing connection relationships with servers according to one or more embodiments of the present disclosure;
FIG. 3 is a schematic flow chart of managing connection relationship with a server according to an embodiment of the present application;
FIG. 4 is a block diagram of an apparatus for managing connection to a server according to one or more embodiments of the present application;
FIG. 5 is an internal block diagram of a computer device provided in accordance with one or more embodiments of the application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings. It should be understood that the described embodiments are merely some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application as detailed in the accompanying claims.
In the description of the present application, it should be understood that the terms "first," "second," "third," and the like are used merely to distinguish between similar objects and are not necessarily used to describe a particular order or sequence, nor should they be construed to indicate or imply relative importance. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art according to the specific circumstances. Furthermore, in the description of the present application, unless otherwise indicated, "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
In view of the shortcomings of the related art, the present application provides a method of managing a connection relationship with a server, which can be applied to an application environment as shown in fig. 1. The client 10 establishes and manages a connection relationship with the server 20 through a preset connection interface, and requests the server 20 to acquire corresponding data through a data interface. The method provided by the application does not adopt a conventional mode of jointly realizing the operation of establishing connection and the operation of requesting data by one interface, but separates the operation of establishing connection from the operation of requesting data, specifically adopts two interfaces, namely a connection interface and a data interface, establishes a connection relation with a server through the connection interface and manages the connection relation, and requests related data from the server through the data interface, thereby being capable of maintaining the connection relation with the server for a long time so as to meet the communication requirement, simultaneously being capable of enabling the server to timely return data, ensuring that the returned data is useful and the sequence is not disordered, and finally realizing the effects of effectively utilizing broadband resources and avoiding occupying server resources for a long time (reducing the pressure of the server) while meeting the communication requirement.
The client 10 may include, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, desktop computers, etc., and the server may be implemented as a stand-alone server or a server cluster composed of a plurality of servers. It should be understood that the number of clients, networks, and servers in fig. 1 is merely illustrative. There may be any number of clients, networks, and servers as desired. It should be further noted that, the "connection relationship" and "connection" referred to herein may also be referred to as "link relationship" and "link" in some cases, each refer to a communication connection established between a client and a server.
In some embodiments, a method for managing a connection relationship with a server according to the present application includes the steps shown in fig. 2, and the following description will take an application of the method to a client in fig. 1 as an example.
S110: and establishing a connection relation with the server through a preset connection interface in response to receiving the connection instruction.
The connection instruction is used for indicating the client to establish a connection relationship with the server. The connection instruction may be user-triggered or may be self-generated by the client.
S120: and executing the connection management logic according to the target calling frequency to manage the connection relation.
The connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic; the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server.
In this embodiment, the javaScript environment and syntax may be used to implement the operations associated with the client sending a request to the server and receiving information returned by the server.
Wherein the server, upon receiving the first request from the client, returns identification information, such as an ID list (e.g., [1,2,3,4 ]). When the client receives the ID list, only the increment part in the ID list received this time, namely the newly added ID list is used as the entry of the data interface to request the corresponding resource data from the server, for example, the last returned ID list of the server is [1,2], and the last returned ID list is [1,2,3,4], and the client only requests the resource data corresponding to [3,4] from the server. Regarding the specific content of the resource data, the content of the resource data in different application scenarios may be, for example, a picture, a session message, etc., and the embodiment does not particularly limit the specific content thereof. It should be further noted that, in the related art, the server returns a large amount of duplicate resource data, and the ID list returned by the server is duplicated with the ID list returned previously, however, since the server returns only the ID list and not the resource data, the occupied resources (such as bandwidth resources at the time of transmission, storage resources at the time of storage, etc.) are small, and the client uses only the increment portion to call the data interface, so that duplicate resource data is not requested.
The connection establishment operation and the data request operation are separated, specifically, two interfaces, namely a connection interface and a data interface are adopted, the connection relationship with the server can be established through a single interface (namely the connection interface), and the established connection relationship is managed, so that the client and the server can maintain the connection relationship for a long time; the data interface is dedicated to requesting related data from the server, specifically, since the present embodiment separates the operation of establishing a connection from the operation of requesting data, when the server receives the first request sent by the client through the connection interface, the server does not return specific data, but returns identification information (such as ID and ID list) for acquiring the related data, after receiving the identification information, the client uses the incremental portion of the identification information as a reference of the data interface, and then invokes the data interface, thereby sending the incremental portion of the identification information to the server, and after receiving the incremental portion of the identification information, the server acquires data corresponding to the incremental portion of the identification information and returns the data to the client. The embodiment can maintain a long-time connection relation with the server to meet the communication requirement, meanwhile, the server can also return data in time, and because the data returned by the server to the connection interface only has identification information and does not carry resource data, a large amount of useless data can be eliminated, in addition, after the client requests corresponding resource data from the server according to the increment part of the identification information, the client can arrange the resource data corresponding to each requested identifier by using the sequence of the identification information, such as [1,2,3,4], so that the requested resource data cannot be disordered, and the effects of effectively utilizing broadband resources and avoiding occupying server resources for a long time (reducing the pressure of the server) can be realized while the communication requirement is met.
The target call frequency indicates how often the connection interface is called. In some embodiments, the target call frequency is a preset fixed frequency, for example, the access amount corresponding to each time period of each day in the past period of time may be counted, and then the frequency corresponding to the time period is set based on the access amount corresponding to each time period, so when step S120 is performed, it is first determined which time period is the current time period, and then the preset frequency corresponding to the time period is acquired as the target call frequency. In other embodiments, the target call frequency is a dynamic frequency determined based on the amount of access corresponding to the current time period. The specific value of the target call frequency is set according to the number of accesses corresponding to the current time period, and thus the present embodiment does not limit the specific value of the target call frequency. The principle of setting the target call frequency according to the access amount may be determined according to the actual situation, for example, when the access amount is larger, the target call frequency may be set to be low (or high) or, conversely, when the access amount is smaller, the target call frequency may be set to be high (or low), and the target call frequency may be set to be faster or slower.
In some embodiments, the connection management logic further comprises, in response to not receiving the response information of the server to the first request, or the response information of the server to the first request indicates a failure in the response, sending the first request again to the server after a preset period of time.
The preset duration may be set according to the actual application scenario, and the embodiment is not particularly limited. In this embodiment, when the client cannot receive the response information of the server to the first request, or the response information of the server to the first request indicates that the response fails, the client will send the first request to the server again through the first interface, so as to maintain the connection relationship with the server. The operation after the first request is sent to the server may be referred to the above embodiment, and will not be described herein.
In some embodiments, when the response information includes the identification information, the response information further includes indication information for indicating whether the task of the current connection is completed. Accordingly, the connection management logic further includes disconnecting the connection relationship with the server in response to the indication information indicating that the task of the current connection has been completed.
Specifically, in some embodiments, the information carried by the first request includes status information indicating whether a call needs to be continued thereafter. Accordingly, disconnecting the connection from the server, comprising: and sending state information carrying with the indication that the call is not required to be continued after the state information is sent to the server so as to indicate the disconnection relationship of the server.
After receiving the first request, the server judges whether the state information carried by the first request indicates that the call is not needed to be continued, and if so, the server is disconnected with the client.
Accordingly, in some embodiments, the connection management logic further includes, in response to the indication information indicating that the task of the current connection is not complete, carrying state information that needs to be continuously invoked after the indication is carried in the first request sent to the server next time, so as to indicate the server to continue to maintain the connection relationship.
In this embodiment, after receiving the first request, the server determines whether the state information carried by the first request indicates that no call needs to be continued later, and if not, the server does not disconnect the connection and continues to maintain the connection relationship with the client.
In some embodiments, the data request logic specifically includes taking the incremental portion of the identification information as a call-in data interface to send a second request to the server, where the second request is used to request the resource data corresponding to the incremental portion, and the second request carries the incremental portion of the identification information. The identification information may be ID information, ID list, or the like, which is information for instructing the server to return the relevant data.
In some embodiments, to improve security, the server may verify the request sent by the client through the data interface when the request is received, where the verification may be performed by using various existing verification methods. For example, the server sends the key to the client in advance, and when the client sends the request through the data interface, the key is carried in the request, so that after the server receives the request, the key is checked first, if the key passes the check, the identification information in the request is extracted again, and the resource data acquired according to the identification information is returned to the client.
The present application provides a specific example to further illustrate the above embodiments. Referring to fig. 3, fig. 3 is a flowchart of this specific example, and mainly includes the following matters:
this example separates the two operations of connection and data, and manages the connection state through the connection interface, thereby enabling the ability of long connections. The client side invokes the connection interface to establish connection with the server, and sends a first request to the server according to a target invoking frequency, wherein the first request carries state information, after receiving the first request, if the state information indicates that the client side needs to continue invoking, the server returns two types of information, namely indication information and identification information, such as an ID list, and after receiving the ID list, the client side invokes a data interface by using the ID list to request the server for acquiring data corresponding to the ID list. After the client sends the first request, the response of the server may not be received (i.e. the server does not react), or the response of the server indicates failure, and then the first request may be reinitiated after n seconds to recover the jitter. Further, after m requests, the server remains unresponsive, and preset processing logic, such as stopping the jitter (i.e., no longer initiating the first request) or continually initiating the first request, may be executed. Wherein n and m may be set according to actual conditions, and are not specifically set here.
It should be noted that, the heartbeat manager is different from the existing heartbeat, so that the heartbeat in the present scheme generally refers to that the front end (i.e. the client) requests information from the server (i.e. the background) at regular time, so that the front end is still in connection, i.e. the websocket long connection, and the connection is a scene that bidirectional communication can be established by one request, and is particularly suitable for instant communication. The heartbeat refers to a call frequency (frequency of calling a connection interface), the call frequency can be set according to practical situations, for example, a certain time period is faster, a certain time period is slower, a long connection established through the heartbeat is unidirectional communication, and multiple requests are needed, so that the heartbeat is more suitable for a scenario that a front end and a background need to be connected for a long time for communication, and the data volume is larger, and is particularly suitable for a scenario with the following characteristics, namely (1) a long time: for example, the client is always connected (idle, sometimes fast, sometimes slow, but needs to be always connected in the middle of many times), and it is worth noting that after the client sends a request to the server through the connection interface or the data interface, after the server returns response information, the connection of the request is disconnected, however, the client will send the first request again through the connection request at intervals until the task ends, so that the client and the server can keep being connected for a long time in service; (2) The client actively requests and the server passively returns information; (3) Big data, namely the data volume is big and repeated, because only the identification information is received through the connection interface instead of the resource data, the situation of big data volume is not afraid; (4) The time periods, i.e. the amount of access per time period, is different, e.g. there is a distinct peak period versus quiet period, which will result in different call frequencies.
It should be noted that, regarding the steps included in the method for managing a connection relationship with a server provided in any of the above embodiments, the steps are not strictly limited to the order of execution unless explicitly described herein, and may be executed in other orders. Moreover, at least some of these steps may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of other steps or sub-steps of other steps.
Based on the same inventive concept, the application also provides a device for managing the connection relation with the server. In some embodiments, the apparatus may be applied to a client, as shown in fig. 4, the apparatus comprising:
the connection establishment module 110 is configured to establish a connection relationship with the server through a preset connection interface in response to receiving the connection instruction;
a connection management module 120 for executing connection management logic according to the target call frequency to manage the connection relationship;
the connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic;
the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server.
In some embodiments, the target call frequency is a fixed frequency that is preset, or a dynamic frequency that is determined according to the amount of access corresponding to the current time period.
In some embodiments, the connection management logic further comprises, in response to not receiving the response information of the server to the first request, or the response information of the server to the first request indicates a failure in the response, sending the first request again to the server after a preset period of time.
In some embodiments, when the response information includes the identification information, the response information further includes indication information for indicating whether the task connected at this time is completed; accordingly, the connection management logic further includes disconnecting the connection relationship with the server in response to the indication information indicating that the task of the current connection has been completed.
In some embodiments, the information carried by the first request includes status information indicating whether a call needs to be continued thereafter; accordingly, the operation of disconnecting the connection relationship with the server in the connection management logic includes: and sending state information carrying with the indication that the call is not required to be continued after the state information is sent to the server so as to indicate the disconnection relationship of the server.
Accordingly, in some embodiments, the connection management logic further includes, in response to the indication information indicating that the task of the current connection is not complete, carrying state information that needs to be continuously invoked after the indication is carried in the first request sent to the server next time, so as to indicate the server to continue to maintain the connection relationship.
In some embodiments, the data request logic specifically includes a data interface for an entry call with an incremental portion of the identification information as a reference to send a second request to the server, the second request requesting resource data corresponding to the incremental portion. The second request carries an incremental portion of the identification information.
In some embodiments, the data request logic further comprises: the resource data requested from the server is ordered according to the identification information.
For specific limitations on the means for managing the connection relationship with the server, reference may be made to the above limitations on the method for managing the connection relationship with the server, and will not be repeated here. The above-described respective modules in the apparatus for managing the connection relationship with the server may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
Further, the present application provides, in some embodiments, a computer device, an internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data such as access amounts corresponding to each time period, and the specific stored data can also be referred to as limitation in the embodiment of the method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of managing a connection relationship with a server.
It will be appreciated by those skilled in the art that the structure shown in FIG. 5 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
The present embodiment also provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor executes the computer program to implement the steps of the method for managing a connection relationship with a server provided in any one of the foregoing embodiments.
In particular, the processor may implement the following steps when executing the computer program:
responding to the received connection instruction, and establishing a connection relation with the server through a preset connection interface; executing connection management logic according to the target calling frequency to manage the connection relation; the connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic; the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server.
In some embodiments, the target call frequency is a fixed frequency that is set in advance, or a dynamic frequency that is determined according to the access amount corresponding to the current time period.
In some embodiments, the connection management logic further comprises, in response to not receiving the response information of the server to the first request, or the response information of the server to the first request indicates a failure in the response, sending the first request again to the server after a preset period of time.
In some embodiments, when the response information includes the identification information, the response information further includes indication information for indicating whether the task connected at this time is completed;
the connection management logic further includes disconnecting the connection relationship from the server in response to the indication information indicating that the task of the current connection is completed.
In some embodiments, the information carried by the first request includes status information indicating whether a call needs to be continued thereafter; correspondingly, the operation of disconnecting the connection relation with the server in the connection management logic specifically comprises the step of sending the state information carrying with the indication that the call is not required to be continued to the server so as to indicate the disconnection relation of the server.
In some embodiments, the connection management logic further includes, in response to the indication information indicating that the task of the current connection is not complete, carrying state information indicating that the call needs to be continued after the next first request sent to the server, so as to indicate that the server continues to maintain the connection relationship.
In some embodiments, the data request logic specifically includes a data interface for an entry call with an incremental portion of the identification information as a reference to send a second request to the server, the second request requesting resource data corresponding to the incremental portion.
In some implementations, the data request logic further includes: the resource data requested from the server is ordered according to the identification information.
The present application also provides in other embodiments a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of managing a connection relationship with a server provided in any of the embodiments above.
In particular, the computer program may, when executed by a processor, implement the steps of:
responding to the received connection instruction, and establishing a connection relation with the server through a preset connection interface; executing connection management logic according to the target calling frequency to manage the connection relation; the connection management logic comprises a step of sending a first request to the server through the connection interface, a step of responding to the received response information of the server to the first request, wherein the response information comprises identification information, and a step of executing the data request logic; the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server.
In some embodiments, the target call frequency is a fixed frequency that is set in advance, or a dynamic frequency that is determined according to the access amount corresponding to the current time period.
In some embodiments, the connection management logic further comprises, in response to not receiving the response information of the server to the first request, or the response information of the server to the first request indicates a failure in the response, sending the first request again to the server after a preset period of time.
In some embodiments, when the response information includes the identification information, the response information further includes indication information for indicating whether the task connected at this time is completed;
the connection management logic further includes disconnecting the connection relationship from the server in response to the indication information indicating that the task of the current connection is completed.
In some embodiments, the information carried by the first request includes status information indicating whether a call needs to be continued thereafter; correspondingly, the operation of disconnecting the connection relation with the server in the connection management logic specifically comprises the step of sending the state information carrying with the indication that the call is not required to be continued to the server so as to indicate the disconnection relation of the server.
In some embodiments, the connection management logic further includes, in response to the indication information indicating that the task of the current connection is not complete, carrying state information indicating that the call needs to be continued after the next first request sent to the server, so as to indicate that the server continues to maintain the connection relationship.
In some embodiments, the data request logic specifically includes a data interface for an entry call with an incremental portion of the identification information as a reference to send a second request to the server, the second request requesting resource data corresponding to the incremental portion.
In some implementations, the data request logic further includes: the resource data requested from the server is ordered according to the identification information.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
Those skilled in the art will appreciate that implementing all or part of the above-described method embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the method embodiments described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus (Rambus), direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (9)

1. A method for managing a connection relationship with a server, the method comprising, applied to a client:
responding to a received connection instruction, and establishing a connection relation with the server through a preset connection interface;
executing connection management logic according to the target calling frequency to manage the connection relation;
the connection management logic includes: sending a first request to the server through the connection interface, responding to the received response information of the server to the first request, wherein the response information comprises identification information corresponding to resource data and indication information used for indicating whether a task connected at this time is completed, and executing data request logic; when the indication information indicates that the task of the current connection is completed, a first request is not sent to the server through the connection interface any more;
the data request logic includes: taking the increment part of the identification information as a reference to call a preset data interface to send a second request to the server, wherein the second request is used for requesting resource data corresponding to the increment part; sorting the resource data requested from the server according to the identification information;
after the client sends a request to the server through the connection interface or the data interface, the connection of the request is disconnected after the server returns response information.
2. The method of claim 1, wherein the target call frequency is a fixed frequency set in advance or a dynamic frequency determined according to an access amount corresponding to a current time period.
3. The method of claim 1, wherein the connection management logic further comprises, in response to not receiving the response information of the server to the first request, or the response information of the server to the first request indicating a failure to respond, sending the first request to the server again after a preset period of time.
4. The method of claim 1, wherein,
the connection management logic further includes disconnecting the connection relationship with the server in response to the indication information indicating that the task of the current connection is completed.
5. The method of claim 4, wherein the information carried by the first request includes status information indicating whether a call needs to be continued thereafter;
disconnecting the connection relationship with the server, comprising:
and sending state information carrying with indication that no call is needed to be continued after the state information is sent to the server so as to instruct the server to disconnect the connection relation.
6. The method of claim 5, wherein the connection management logic further comprises, in response to the indication information indicating that the task of the current connection is not complete, carrying status information indicating that a call needs to be continued after a next first request sent to the server to indicate that the server continues to maintain the connection relationship.
7. An apparatus for implementing the method for managing a connection relationship with a server according to claim 1, wherein the apparatus is applied to a client, and the apparatus comprises:
the connection establishment module is used for establishing a connection relation with the server through a preset connection interface in response to receiving a connection instruction;
the connection management module is used for executing connection management logic according to the target calling frequency so as to manage the connection relation;
the connection management logic comprises a first request sent to the server through the connection interface, response information of the server to the first request is received, the response information comprises identification information, and data request logic is executed;
the data request logic comprises a preset data interface which is called according to the identification information so as to request corresponding resource data from the server.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 6 when the computer program is executed by the processor.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311107773.5A 2023-08-30 2023-08-30 Method, device, equipment and medium for managing connection relation with server Active CN116828022B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311107773.5A CN116828022B (en) 2023-08-30 2023-08-30 Method, device, equipment and medium for managing connection relation with server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311107773.5A CN116828022B (en) 2023-08-30 2023-08-30 Method, device, equipment and medium for managing connection relation with server

Publications (2)

Publication Number Publication Date
CN116828022A CN116828022A (en) 2023-09-29
CN116828022B true CN116828022B (en) 2023-11-24

Family

ID=88120718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311107773.5A Active CN116828022B (en) 2023-08-30 2023-08-30 Method, device, equipment and medium for managing connection relation with server

Country Status (1)

Country Link
CN (1) CN116828022B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105071976A (en) * 2015-09-08 2015-11-18 安一恒通(北京)科技有限公司 Data transmission method and device
CN106372490A (en) * 2016-08-30 2017-02-01 王竞 Peripheral equipment connection method and data interface device
CN110336856A (en) * 2019-05-10 2019-10-15 成都终身成长科技有限公司 Interface call method, device, electronic equipment and storage medium
CN112187908A (en) * 2020-09-23 2021-01-05 易小博(武汉)科技有限公司 Data processing method, system and interface service platform
CN112423145A (en) * 2020-11-16 2021-02-26 北京达佳互联信息技术有限公司 Data processing method, device, system, server and medium
CN115118524A (en) * 2022-08-22 2022-09-27 南京沁恒微电子股份有限公司 Interface equipment and free intercommunication data transparent transmission method, system and device of Internet of things

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11070610B2 (en) * 2019-08-22 2021-07-20 Open Text Corporation System and method for data transfer, including protocols for use in data transfer in a content management environment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105071976A (en) * 2015-09-08 2015-11-18 安一恒通(北京)科技有限公司 Data transmission method and device
CN106372490A (en) * 2016-08-30 2017-02-01 王竞 Peripheral equipment connection method and data interface device
CN110336856A (en) * 2019-05-10 2019-10-15 成都终身成长科技有限公司 Interface call method, device, electronic equipment and storage medium
CN112187908A (en) * 2020-09-23 2021-01-05 易小博(武汉)科技有限公司 Data processing method, system and interface service platform
CN112423145A (en) * 2020-11-16 2021-02-26 北京达佳互联信息技术有限公司 Data processing method, device, system, server and medium
CN115118524A (en) * 2022-08-22 2022-09-27 南京沁恒微电子股份有限公司 Interface equipment and free intercommunication data transparent transmission method, system and device of Internet of things

Also Published As

Publication number Publication date
CN116828022A (en) 2023-09-29

Similar Documents

Publication Publication Date Title
CN109547511B (en) WEB message real-time pushing method, server, client and system
KR102208935B1 (en) Messaging api over http protocol to establish context for data exchange
US9565218B2 (en) Resource management for WebRTC
EP3709664B1 (en) Stream pushing method, system and server
US9172765B2 (en) Polling-based secure network message notification system and method with performance enhancing features
CN112118315A (en) Data processing system, method, device, electronic equipment and storage medium
CN112422497B (en) Message transmission method and device and computer equipment
CN107528891B (en) Websocket-based automatic clustering method and system
CN111193789B (en) Subscription information pushing method, device, computer equipment and readable storage medium
CN111245831B (en) FTP data transmission method and device, and information interaction system of server and client
CN109088918B (en) Interaction method, client device and server device
CN116828022B (en) Method, device, equipment and medium for managing connection relation with server
KR101367265B1 (en) Push server, push service providing system and method of the same
WO2021134766A1 (en) Method, apparatus and device for determining device state, and storage medium
CN109120578B (en) Method and device for realizing link connection processing
CN116192927A (en) Data transmission method and device based on SaaS service, computer equipment and medium
US10108588B2 (en) Method and system for communicating between client pages
CN115714805A (en) Cross-platform communication connection method and system and electronic equipment
CN112291371B (en) Conference message real-time synchronization method, system, device and storage medium
CN115297105A (en) File transmission method and device, computer equipment and storage medium
CN112612848A (en) Method, device and system for real-time data synchronization, electronic equipment and storage medium
CN114143127B (en) Data broadcasting method and device and electronic equipment
CN109981717A (en) A kind of connection optimization method, device and computer storage medium
CN114257630B (en) Classroom real-time interaction method, system, terminal equipment and readable storage medium
CN112165535B (en) Message pushing processing method and system

Legal Events

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