CN112383617A - Method, device, terminal equipment and medium for long connection - Google Patents

Method, device, terminal equipment and medium for long connection Download PDF

Info

Publication number
CN112383617A
CN112383617A CN202011260317.0A CN202011260317A CN112383617A CN 112383617 A CN112383617 A CN 112383617A CN 202011260317 A CN202011260317 A CN 202011260317A CN 112383617 A CN112383617 A CN 112383617A
Authority
CN
China
Prior art keywords
long connection
service
protocol
services
long
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011260317.0A
Other languages
Chinese (zh)
Inventor
任利琴
张弛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202011260317.0A priority Critical patent/CN112383617A/en
Publication of CN112383617A publication Critical patent/CN112383617A/en
Pending legal-status Critical Current

Links

Images

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/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • 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

Abstract

The present disclosure relates to a method, an apparatus, a terminal device and a medium for performing long connection, and relates to the field of data communication, and in particular, to a network connection method for an application. The method comprises the following steps: acquiring long connection configuration information of at least two services in an application program through a configuration interface shared by the services; determining at least one long connection protocol for establishing a long connection based on long connection configuration information of at least two services; establishing a respective at least one long connection based on the determined at least one long connection protocol; and communicating with the service server for at least two services via the established at least one long connection. The embodiment provided by the disclosure can provide uniform long connection for different services in the application program.

Description

Method, device, terminal equipment and medium for long connection
Technical Field
Embodiments of the present disclosure relate to the field of data communication, and in particular, to a network connection method for an application, and in particular, to a method, an apparatus, a terminal device, and a medium for performing long connection.
Background
Frequent operation and communication between the client and the server is facilitated by establishing a long connection between the client and the server. The real-time communication between the client and the server can be realized through the long connection, so that the long connection has wide application scenes in the data communication process between the electronic equipment and the server at present.
Disclosure of Invention
According to an aspect of an exemplary embodiment of the present disclosure, there is provided a method for making a long connection for a Flutter application, including: acquiring long connection configuration information of at least two services in an application program through a configuration interface shared by the services; determining at least one long connection protocol for establishing a long connection based on long connection configuration information of at least two services; establishing a respective at least one long connection based on the determined at least one long connection protocol; and communicating with the service server for at least two services via the established at least one long connection.
According to another aspect of the exemplary embodiments of the present disclosure, there is provided an apparatus for making a long connection for a Flutter application, including: the configuration unit is configured to acquire long connection configuration information of at least two services in the application program through a configuration interface shared by the services; a protocol determination unit configured to determine at least one long connection protocol for establishing a long connection based on long connection configuration information of at least two services; a long connection establishing unit configured to establish at least one long connection based on the determined at least one long connection protocol; and the communication unit is configured to communicate with the service servers of at least two services through the established at least one long connection.
According to another aspect of an exemplary embodiment of the present disclosure, a terminal device is provided. The electronic device includes: a processor and a memory storing a program. The program comprises instructions which, when executed by a processor, cause the processor to perform a method according to some exemplary embodiments of the present disclosure.
According to another aspect of exemplary embodiments of the present disclosure, there is provided a computer-readable storage medium storing a program. The program comprises instructions which, when executed by a processor of the electronic device, cause the processor to perform a method according to some exemplary embodiments of the present disclosure.
By means of the method, the device, the terminal device and the medium for long connection in the exemplary embodiments of the present disclosure, a method for integrating long connection resources of different services in an application can be provided for a Flutter application with a cross-platform property, network resources required in the application program use process can be saved, the time required for establishing connection is reduced, and the stability of connection is improved. By providing a uniform long connection method, the integration difficulty of the network scheme in the development process of the application program can be reduced.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the embodiments and, together with the description, serve to explain the exemplary implementations of the embodiments. The illustrated embodiments are for purposes of illustration only and do not limit the scope of the claims. Throughout the drawings, identical reference numbers designate similar, but not necessarily identical, elements:
fig. 1 shows an exemplary flow diagram of a method of making a long connection according to an embodiment of the present disclosure;
fig. 2 illustrates an exemplary process of a method for communicating with a business server in accordance with an embodiment of the disclosure;
3A-3B illustrate exemplary scenario diagrams for long connections with applications of embodiments of the present disclosure;
FIG. 4A shows a schematic block diagram of a long connection module of an application according to an embodiment of the present disclosure;
FIG. 4B shows a schematic diagram of a protocol module, according to an embodiment of the present disclosure;
FIG. 5 shows a schematic block diagram of an apparatus for making long connections according to an embodiment of the present disclosure; and
fig. 6 shows a schematic block diagram of an example computing device, according to an example embodiment of the present disclosure.
Detailed Description
In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, the timing relationship, or the importance relationship of the elements, and such terms are used only to distinguish one element from another. In some examples, a first element and a second element may refer to the same instance of the element, and in some cases, based on the context, they may also refer to different instances.
The terminology used in the description of the various described examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the elements may be one or more. Furthermore, the term "and/or" as used in this disclosure is intended to encompass any and all possible combinations of the listed items. For example, a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
When an application installed on a terminal device is used, data communication between the terminal and the server can be realized through a network connection between the application and the server. In application scenarios such as real-time communication, a long connection needs to be established between an application and a server to enable real-time data communication. The developer can integrate the corresponding network module in the application program during the development process of the application program so that the application program can establish network connection with the server side during the use process.
Different operating systems, such as an Android (Android) system or an iOS system, may be installed on a currently commonly used terminal device. In some cases, applications for different operating systems are developed using different development tools, and thus, different network libraries need to be integrated for applications running under different operating systems, respectively.
Furthermore, there may be at least two different business scenarios within the same application. For example, different service scenarios such as instant messaging service, cloud storage service, payment service, and the like may exist in the instant messaging application. It is understood that different service scenarios may communicate with different service terminals to implement service functions. In this case, since different service scenarios may require different types of long connection services, it is necessary to integrate multiple network libraries supporting different network protocols into the application, which makes the installation package of the application bulky and has a complex network interface. In addition, since long connections occupy network resources for a long time, establishing long connections for different service scenarios respectively causes waste of network resources.
In some embodiments, the application may be a Flutter application. Flutter is a mobile user interface UI framework provided by google, which is a cross-platform mechanism capable of providing cross-platform development of business functions for applications running in the iOS system and the android system. At present, for a Flutter application program developed based on a Flutter framework, a network library which can support a plurality of different network protocols for configuration and long connection establishment does not exist. In addition, there is no network library that can provide Quic protocol connections and GRCP protocol connections for the Flutter application.
In order to integrate network connections of different services within an application, the present disclosure provides a new method of making long connections. Embodiments of the present disclosure are further described below with reference to the accompanying drawings.
Fig. 1 shows an exemplary flowchart of a method of making a long connection according to an embodiment of the present disclosure.
As shown in fig. 1, in step S102, long connection configuration information of at least two services in an application may be acquired via a configuration interface shared by the services.
In some embodiments, at least two services in an application may provide long connection configuration information for the services via a configuration interface shared by the services. In this way, the long connection module in the application can establish a long connection between the application and the long connection server based on the long connection configuration information of the at least two services.
In some embodiments, for each of at least two services in an application, the long connection configuration information may include a network protocol supported by the service. That is, the service is able to establish a long connection based on at least one predefined network protocol. In some implementations, the network protocol supported by the service may be at least one selected from the group consisting of: transmission Control Protocol (TCP), secure transport layer protocol (TLS), hypertext transfer protocol (HTTP), Quic protocol, and GRPC protocol. Wherein the HTTP protocol may include at least one of an HTTP1 protocol and an HTTP2 protocol. Therefore, the long connection method provided by the disclosure can integrate long connections of multiple services supporting different network protocols.
In some embodiments, the long connection configuration information for the service may also include configuration information such as an Internet Protocol (IP) address, port, etc. required to establish the network connection.
In some embodiments, the at least two services in the application refer to two or more services. The services of an application as referred to herein may refer to functions that can be implemented within the application. In some examples, the traffic in the application may include instant messaging, streaming media transmission, information subscription, payment, cloud storage, and so on. The specific type of the service in the application is not limited herein, and a developer of the application can select the type of the service in the application according to actual needs.
It is understood that the network protocols supported by different services may be different due to differences in the data types and service modes used by the services.
In some implementations, the network protocols supported by different services may be different. In some examples, the at least two services of the application may include a first service and a second service different from the first service, wherein the first service supports a first protocol and the second service supports a second protocol, and the second protocol and the first protocol may be different.
In other implementations, there may also be different services that support the same network protocol. In some examples, the at least two services of the application may include a third service and a fourth service different from the third service, wherein the third service supports the third protocol and the fourth service also supports the third protocol.
In some embodiments, a service may support at least one network protocol. That is, one of a plurality of network protocols may be selected to establish a long connection for the service. For example, a service may support both long connections of the TCP protocol and long connections of the HTTP1 protocol. In this case, one of the TCP protocol and the HTTP1 protocol may be arbitrarily selected to establish a long connection for the service.
In step S104, at least one long connection protocol for establishing a long connection may be determined based on the long connection configuration information of the at least two services.
For at least two services in the application program, in order to meet the normal use of the functions of the services, long connection can be established for each service according to the long connection configuration information of each service.
In some embodiments, for different services supporting different network protocols, long connections based on different network protocols may be established for the different services, respectively. For example, it may be determined that at least one long connection protocol includes the first protocol for the first service and the second protocol for the second service based on long connection configuration information of the first service and long connection configuration information of the second service. In some examples, taking the example that the long connection configuration information of the first service indicates that the first service supports the TCP protocol and the long connection configuration information of the second service indicates that the second service supports the HTTP1 protocol, it may be determined to establish a long connection of the TCP protocol for the first service and a long connection of the HTTP1 protocol for the second service based on the long connection configuration information of the first service and the long connection configuration information of the second service.
In some embodiments, different services supporting the same network protocol may share the same long connection. For example, it may be determined that the at least one long connection protocol further includes a third protocol for the third service and the fourth service based on the long connection configuration information of the third service and the fourth service. In some examples, taking the example that the long connection configuration information of the third service indicates that the third service supports the Quic protocol, and the long connection configuration information of the fourth service indicates that the fourth service also supports the Quic protocol, it may be proposed to simultaneously use the long connections of the Quic protocols for the third service and the fourth service, so as to establish a long connection of the Quic protocol that can be shared for the third service and the fourth service. By using the method, a long connection of a Quic protocol is not required to be established for the third service and the fourth service respectively, and network resources can be saved.
In some embodiments, a service in an application may support more than one network protocol. For example, the first traffic may support a Quic protocol in addition to the TCP protocol. The third service may support the HTTP2 protocol in addition to the Quic protocol. In this case, a network protocol commonly supported by different protocols may be determined as a network protocol for establishing a long connection based on a rule set in advance. That is, although both the first service and the third service support another network protocol other than the Quic protocol, in order to enable the first service and the third service to share the same long connection, the Quic protocol commonly supported by the first service and the third service may be selected as the network protocol for establishing the long connection, thereby saving network resources.
In step S106, a respective at least one long connection may be established based on the determined at least one long connection protocol.
As described in connection with step S104, at least one long connection that can satisfy each service may be determined according to the long connection configuration information of each service within the application. For example, in the case where the first service supports the TCP protocol and the Quic protocol, the second service supports the HTTP1 protocol, the third service supports the Quic protocol and the HTTP2 protocol, and the fourth service supports the Quic protocol, the long connection of the Quic protocol for the first service, the third service, and the fourth service, and the long connection of the HTTP1 protocol for the second service may be established in step S106.
In some embodiments, protocol modules for different network protocols are integrated in the application. In some implementations, protocol modules for multiple different network protocols may be integrated into one unified long connection module. For each of the determined at least one long connection protocol, loading a protocol module corresponding to the long connection protocol to establish a corresponding long connection based on the long connection protocol. The working principle of the unified long connection module will be described below with reference to fig. 4A and 4B. And will not be described in detail herein.
In some embodiments, the at least one long connection established for the at least two services in the application is a network connection between the application and a long connection service. In some implementations, at least one service in an application may share the same long connection server. That is, the at least one long connection is a network connection established between the application and the same long connection server. In some examples, the long connection may be established according to an IP address, a port, and any other information required for network connection included in the long connection configuration information of the traffic.
In step S108, communication with the service terminals of at least two services can be performed via the established at least one long connection.
At least two services in the application may correspond to different service ends. Service servers corresponding to the services can be deployed in the server. Different business servers can be deployed in the same server or different servers. The servers used to deploy the business servers may be distributed.
As mentioned above, the long connections of different or same protocols established for different services in step S106 may all be connected to the same long connection server. In order to enable each service to realize its own function, the long connection service end may be used to forward the service data of each service to the corresponding service end, and the long connection service end receives the data returned by the service end and forwards the data to the corresponding service. In some embodiments, the service data may be a data type such as JSON, Protobuf, byte, and the like, and the specific type of the service data is not limited herein.
In some embodiments, the long connection method for an application may further include a disconnection step. In some embodiments, the established at least one long connection may be disconnected in response to a disconnect request from at least two services in the application.
In some implementations, for a long connection of any network protocol, when a service using the long connection of the network protocol makes a disconnection request, the long connection is not disconnected if there are still other services using the long connection. The long connection may be disconnected if no other traffic uses the long connection.
By utilizing the method for performing long connection in the exemplary embodiment of the disclosure, a method for integrating long connection resources of different services in an application can be provided for a Flutter application with cross-platform property, network resources required in the application program using process can be saved, the time spent on establishing connection is reduced, and the stability of connection is improved. In addition, by providing a uniform long connection method, the integration difficulty of the network scheme in the application program development process can be reduced.
Fig. 2 illustrates an exemplary process of a method for communicating with a business server in accordance with an embodiment of the disclosure.
As shown in fig. 2, in step S202, service data of at least two services may be sent to the long connection service end via at least one long connection, where the service data includes service identifiers of the corresponding services.
Different services in the application program are all connected to the same long connection service end, and the long connection service end needs to forward service data of different services. In some embodiments, a service identifier may be added to the service data, so that the long connection service end can distinguish data for different services based on the service identifier.
In some embodiments, at least two services in the application program can send service data to the long connection server via the service shared call interface.
In some embodiments, each service in the application may register its own service identifier in the long connection server. In some implementations, the service identifier may be registered at a network connection listener of the long connection service.
In the process of data communication, at least two services in the application program send service data of each service to the long connection server through long connection by calling the shared calling interface.
In step S204, response data in response to the service data may be received from the long connection service. Wherein the response data is obtained by transmitting the service data to the service server corresponding to the service identifier based on the service identifier by using the long connection service server.
As described above, after receiving the service data of each service, the long connection service end may send the service data of different services to the service end corresponding to the service identifier based on the service identifier. In response to receiving the service data of the corresponding service, the service server may send the corresponding response data to the long connection server.
At least two services of the application are connected to the same long connection server through the long connection. Therefore, the long connection service end transmits the response data sent by the service end of each service to the corresponding service. In some embodiments, the response data may include a service identifier. The long connection server may send the response data to the corresponding service based on the service identifier to enable the application to perform the processing of the service logic.
Fig. 3A-3B illustrate exemplary scenarios for long connections using an application of an embodiment of the present disclosure. In the application scenario shown in fig. 3A, the service module 311 of the application 310 may have N different services, including service 1, service 2 … …, service N. The N services may support long connections of the same or different types. By using the method described in the present disclosure in conjunction with fig. 1 and fig. 2, the N services can establish a shared long connection between the long connection module 312 integrated in the application and the long connection server, thereby implementing network connection with the corresponding service server.
In some embodiments, at least two network protocols may be integrated into long connection module 312. As shown in fig. 3B, the long connection module 312 may be integrated with HTTP1 protocol, HTTP2 protocol, TCP protocol, etc. In some embodiments, the long connection module 312 may also integrate GRCP protocol and Quic protocol.
As described above, the service 1 may send the service data of the service 1 to the long connection service end via the long connection, and the long connection service end forwards the service data of the service 1 to the service end 1331. In some implementations, the long connection service may forward the service data of service 1 to the service 1331 based on the service identifier of service 1. After receiving the response data sent by the service server 1, the long connection server may also distribute the response data to the service 1 via the long connection shown in fig. 3A. Similarly, the N services in the application 310 may utilize the long connection established between the application and the long connection server to perform network connection, so as to perform data communication with the service servers such as the service server 2332 and the service server N333.
Fig. 4A shows a schematic block diagram of a long connection module of an application according to an embodiment of the present disclosure.
As shown in fig. 4A, the long connection module 410 may include a protocol module 411 and an input/output module 412. At least two network protocols can be integrated in the protocol module 411. In some embodiments, two or more of a transmission control protocol, a secure transport layer protocol, a hypertext transfer protocol, a Quic protocol, and a GRPC protocol may be integrated into protocol module 411. In other embodiments, the protocol module 411 may also integrate more other types of network protocols.
In some implementations, the invocation modules of at least two network protocols may be integrated based on the Dart language.
As shown in fig. 4A, in the long connection module, the protocol module 411 can be accessed and called through the configuration interface 413, the connection interface 414, the disconnection interface 415, and the call interface 416.
When the application integrated with the long connection module 410 is started, the configuration interface 413 may be called, and the initial long connection option, the unique long connection identifier required by the long connection service, and the protocol policy required by the long connection service are obtained. In some embodiments, the initial long connection option, the unique long connection identifier required for the long connection service, and the protocol policy required for the long connection service may be issued by the long connection service 420.
When a service in an application needs to establish a long connection, the configuration interface 413 may obtain long connection configuration information of the service and determine a long connection protocol for establishing the long connection.
Based on the configuration information of the long connection of the service that needs to be used currently and the information required to establish the long connection acquired from the long connection service, the service may call the module required by the corresponding network protocol integrated in the protocol module via the connection interface 414 to establish the long connection between the long connection module 410 and the long connection service 420 in the application. During a long connection, data may be sent/received via input/output module 412 in long connection module 410.
A service in the application may use registration interface 417 and send a service identifier required for transmitting service data to the long-connection service via input/output module 412 to register the network connection listener at long-connection service 420.
During the long connection process, the service can call the call interface 416 of the long connection module to send service data to the long connection server via the input/output module in the long connection module via the established long connection, and receive response data returned by the service server (431, 432) from the long connection server. The long-connection server 420 may forward the service data to the corresponding service server based on the registered service identifier, and distribute the response data received from the service server to the service based on the service identifier.
When a service no longer requires a long connection, the long connection used by the service may be disconnected by calling the disconnect interface 415 of the long connection module. As previously mentioned, the lengthy connection may be kept unbroken if there are other services that are still using the connection.
Fig. 4B shows a schematic diagram of a protocol module, according to an embodiment of the disclosure.
As shown in fig. 4B, the protocol module 411 may include a configuration unit 4111, a connection unit 4112, a disconnection unit 4113, and a transmission unit 4114. In some embodiments, the protocol module 411 may include a plurality of sub-modules for different network protocols, and each sub-module includes a respective configuration unit 4111, a connection unit 4112, a disconnection unit 4113, and a transmission unit 4114. The configuration unit, the connection unit, the disconnection unit, and the transmission unit for different network protocols may be encapsulated separately. All the network protocol sub-modules can be called through a unified configuration interface, a connection interface, a disconnection interface and a calling interface. After the network protocol to be used for the long connection is determined, the sub-modules of the corresponding types can be called according to the determined type of the network protocol.
The principles of the present disclosure will be described below by taking, as an example, a sub-module for one network protocol in the protocol module 411. It is understood that the process described in fig. 4B may be applied to any of the network protocol sub-modules in the protocol module 411.
The configuration unit 4111 may obtain configuration information for establishing the long connection, such as an IP address, a port, etc., by calling the configuration interface 413.
The connection unit 4112 may establish a connection based on the network protocol corresponding to the sub-module based on the configuration information obtained by the configuration unit.
When the service sends data through the call interface 416, the transmission unit 4114 may call the data to a sending interface of a network protocol to transmit the data to the long connection server through the input/output module of the long connection module.
The disconnection unit 4113 may disconnect in response to a disconnection request received by the disconnection interface. In some implementations, the disconnection unit can also destroy objects for connection created at the time of connection.
It can be understood that, due to differences in processing manners of creating connection, transmitting data, and disconnecting different network protocols, when creating the package of the sub-module of each network protocol, a person skilled in the art may add more units or omit some units in the sub-module according to actual situations.
Fig. 5 shows a schematic block diagram of an apparatus for making long connections according to an embodiment of the present disclosure. As shown in fig. 5, the apparatus 500 may include a configuration unit 510, a protocol determination unit 520, a long connection establishment unit 530, and a communication unit 540.
The configuration unit 510 may be configured to obtain long connection configuration information of at least two services in an application via a configuration interface for service sharing. The protocol determination unit 520 may be configured to determine at least one long connection protocol for establishing a long connection based on long connection configuration information of at least two services. The long connection establishing unit 530 may be configured to establish the respective at least one long connection based on the determined at least one long connection protocol. The communication unit 540 may be configured to communicate with the service ends of at least two services via the established at least one long connection.
The operations of the above units 510 to 540 of the apparatus 500 for monitoring an image forming apparatus are similar to the operations of the steps S102 to S108 described above, and are not described again.
By using the device for long connection in the exemplary embodiment of the disclosure, a method for integrating long connection resources of different services in an application can be provided for a Flutter application with cross-platform property, network resources required in the application program using process can be saved, the time spent on establishing connection is reduced, and the stability of connection is improved. In addition, by providing a uniform long connection method, the integration difficulty of the network scheme in the application program development process can be reduced.
Although specific functionality is discussed above with reference to particular modules, it should be noted that the functionality of the various modules discussed herein may be divided into multiple modules and/or at least some of the functionality of multiple modules may be combined into a single module. Performing an action by a particular module discussed herein includes the particular module itself performing the action, or alternatively the particular module invoking or otherwise accessing another component or module that performs the action (or performs the action in conjunction with the particular module). Thus, a particular module that performs an action can include the particular module that performs the action itself and/or another module that the particular module invokes or otherwise accesses that performs the action.
More generally, various techniques may be described herein in the general context of software hardware elements or program modules. The various elements described above with respect to fig. 5 may be implemented in hardware or in hardware in combination with software and/or firmware. For example, the modules may be implemented as computer program code/instructions configured to be executed in one or more processors and stored in a computer-readable storage medium. Alternatively, the modules may be implemented as hardware logic/circuitry. For example, in some embodiments, one or more of the configuration unit 510, the protocol determination unit 520, the long connection establishment unit 530, and the communication unit 540 may be implemented together in a system on chip (SoC). The SoC may include an integrated circuit chip including one or more components of a processor (e.g., a Central Processing Unit (CPU), microcontroller, microprocessor, Digital Signal Processor (DSP), etc.), memory, one or more communication interfaces, and/or other circuitry, and may optionally execute received program code and/or include embedded firmware to perform functions.
An exemplary embodiment of the present disclosure provides an electronic device that may be used as a terminal device, which may include a processor; and a memory storing a program comprising instructions that, when executed by the processor, cause the processor to perform any of the methods previously described.
The exemplary embodiments of the present disclosure also provide a computer-readable storage medium storing a program comprising instructions which, when executed by a processor of an electronic device, cause the processor to perform any of the methods described above.
Examples of such electronic devices and computer-readable storage media are described below with reference to fig. 6.
Fig. 6 illustrates an example configuration of a computing device 600 that may be used to implement the modules and functions or electronic devices described herein. Computing device 600 may be a variety of different types of devices, such as a server of a service provider, a device associated with a client (e.g., a client device), a system on a chip, and/or any other suitable computing device or computing system. Examples of computing device 600 include, but are not limited to: a desktop computer, a server computer, a notebook or netbook computer, a mobile device (e.g., a tablet or phablet device, a cellular or other wireless phone (e.g., a smartphone), a notepad computer, a mobile station), a wearable device (e.g., glasses, a watch), an entertainment device (e.g., an entertainment appliance, a set-top box communicatively coupled to a display device, a game console), a television or other display device, an automotive computer, and so forth. Thus, the computing device 600 may range from a full resource device with substantial memory and processor resources (e.g., personal computers, game consoles) to a low-resource device with limited memory and/or processing resources (e.g., traditional set-top boxes, hand-held game consoles).
Computing device 600 may include at least one processor 602, memory 604, communication interface(s) 606, display device 608, other input/output (I/O) devices 610, and one or more mass storage devices 612, which may be capable of communicating with each other, such as through system bus 614 or other appropriate connection.
Processor 602 may be a single processing unit or multiple processing units, all of which may include single or multiple computing units or multiple cores. The processor 602 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuitry, and/or any devices that manipulate signals based on operational instructions. Among other capabilities, the processor 602 can be configured to retrieve and execute computer readable instructions stored in the memory 604, mass storage device 612, or other computer readable medium, such as program code for an operating system 616, program code for an application program 618, program code for other programs 620, and so forth.
Memory 604 and mass storage device 612 are examples of computer storage media for storing instructions that are executed by processor 602 to implement the various functions described above. By way of example, memory 604 may generally include both volatile and nonvolatile memory (e.g., RAM, ROM, and the like). In addition, mass storage device 612 may generally include a hard disk drive, solid state drive, removable media, including external and removable drives, memory cards, flash memory, floppy disks, optical disks (e.g., CDs, DVDs), storage arrays, network attached storage, storage area networks, and the like. Memory 604 and mass storage device 612 may both be referred to herein collectively as memory or computer storage media, and may be non-transitory media capable of storing computer-readable, processor-executable program instructions as computer program code that may be executed by processor 602 as a particular machine configured to implement the operations and functions described in the examples herein.
A number of program modules may be stored on the mass storage device 612. These programs include an operating system 616, one or more application programs 618, other programs 620, and program data 622, which can be loaded into memory 604 for execution. Examples of such applications or program modules may include, for instance, computer program logic (e.g., computer program code or instructions) for implementing the following components/functions: a configuration unit 510, a protocol determination unit 520, a long connection establishment unit 530, and a communication unit 540, methods described in connection with fig. 1-2, and/or further embodiments described herein.
Although illustrated in fig. 6 as being stored in memory 604 of computing device 600, modules 616, 618, 620, and 622, or portions thereof, may be implemented using any form of computer-readable media that is accessible by computing device 600. As used herein, "computer-readable media" includes at least two types of computer-readable media, namely computer storage media and communication media.
Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information for access by a computing device.
In contrast, communication media may embody computer readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transport mechanism. Computer storage media, as defined herein, does not include communication media.
Computing device 600 may also include one or more communication interfaces 606 for exchanging data with other devices, such as over a network, direct connection, and the like, as previously discussed. Such communication interfaces may be one or more of the following: any type of network interface (e.g., a Network Interface Card (NIC)), wired or wireless (such as IEEE 802.11 wireless lan (wlan)) wireless interface, a global microwave access interoperability (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth. The communication interface 606 may facilitate communication within a variety of networks and network protocols, including wired networks (e.g., LAN, cable, etc.) and wireless networks (e.g., WLAN, cellular, satellite, etc.), the Internet, and so forth. The communication interface 606 may also provide for communication with external storage devices (not shown), such as in storage arrays, network attached storage, storage area networks, and so forth.
In some examples, a display device 608, such as a monitor, may be included for displaying information and images to a user. Other I/O devices 610 may be devices that receive various inputs from a user and provide various outputs to the user, and may include touch input devices, gesture input devices, cameras, keyboards, remote controls, mice, printers, audio input/output devices, and so forth.
While the disclosure has been illustrated and described in detail in the drawings and foregoing description, such illustration and description are to be considered illustrative and exemplary and not restrictive; the present disclosure is not limited to the disclosed embodiments. Variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed subject matter, from a study of the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps not listed, the indefinite article "a" or "an" does not exclude a plurality, and the term "a plurality" means two or more. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.

Claims (15)

1. A method for making long connections for a Flutter application, comprising:
acquiring long connection configuration information of at least two services in an application program through a configuration interface shared by the services;
determining at least one long connection protocol for establishing a long connection based on the long connection configuration information of the at least two services;
establishing a respective at least one long connection based on the determined at least one long connection protocol;
communicating with the service servers for the at least two services via the established at least one long connection.
2. The method of claim 1, wherein the long connection configuration information of each of the at least two services comprises a network protocol supported by the service.
3. The method of claim 2, wherein the network protocol is at least one selected from the group consisting of: transmission control protocol, secure transport layer protocol, hypertext transfer protocol, Quic protocol, and GRPC protocol.
4. The method of claim 2, wherein the at least two services include a first service and a second service different from the first service, the first service supporting a first protocol, the second service supporting a second protocol, the second protocol being different from the first protocol.
5. The method of claim 4, wherein determining at least one long connection protocol for establishing a long connection based on long connection configuration information of the at least two services comprises:
determining that the at least one long connection protocol includes the first protocol for the first service and the second protocol for the second service based on long connection configuration information of the first service and long connection configuration information of the second service.
6. The method of claim 5, wherein the at least two services include a third service and a fourth service different from the third service, the third service supporting a third protocol, the fourth service supporting the third protocol.
7. The method of claim 6, wherein determining at least one long connection protocol for establishing a long connection based on long connection configuration information of the at least two services further comprises:
determining that the at least one long connection protocol further includes the third protocol for the third service and the fourth service based on long connection configuration information of the third service and the fourth service.
8. The method of claim 1, wherein establishing the respective at least one long connection based on the determined at least one long connection protocol comprises:
for each of the determined at least one long connection protocol, loading a protocol module corresponding to the long connection protocol to establish a corresponding long connection based on the long connection protocol.
9. The method of claim 1, wherein the at least one long connection is a network connection between the application and a long connection service.
10. The method of claim 9, wherein communicating with a service server for the at least two services via the established at least one long connection comprises:
sending service data of the at least two services to the long connection server via the at least one long connection, wherein the service data comprises service identifiers of corresponding services; and
receiving response data in response to the traffic data from the long connection service terminal,
wherein the response data is obtained by transmitting the service data to a service server corresponding to the service identifier based on the service identifier using the long connection service server.
11. The method of claim 9, wherein the at least one service shares the same long connection service.
12. The method of claim 1, further comprising:
disconnecting the established at least one long connection in response to a disconnection request from the at least two services.
13. An apparatus for making long connections for a Flutter application, comprising:
the configuration unit is configured to acquire long connection configuration information of at least two services in the application program through a configuration interface shared by the services;
a protocol determining unit configured to determine at least one long connection protocol for establishing a long connection based on long connection configuration information of the at least two services;
a long connection establishing unit configured to establish at least one long connection based on the determined at least one long connection protocol;
a communication unit configured to communicate with the service servers of the at least two services via the established at least one long connection.
14. A terminal device, comprising:
a processor; and
a memory storing a program comprising instructions that, when executed by the processor, cause the processor to perform the method of any of claims 1 to 12.
15. A computer readable storage medium storing a program, the program comprising instructions that, when executed by a processor of an electronic device, cause the processor to perform the method of any of claims 1-12.
CN202011260317.0A 2020-11-12 2020-11-12 Method, device, terminal equipment and medium for long connection Pending CN112383617A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011260317.0A CN112383617A (en) 2020-11-12 2020-11-12 Method, device, terminal equipment and medium for long connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011260317.0A CN112383617A (en) 2020-11-12 2020-11-12 Method, device, terminal equipment and medium for long connection

Publications (1)

Publication Number Publication Date
CN112383617A true CN112383617A (en) 2021-02-19

Family

ID=74583147

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011260317.0A Pending CN112383617A (en) 2020-11-12 2020-11-12 Method, device, terminal equipment and medium for long connection

Country Status (1)

Country Link
CN (1) CN112383617A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113923249A (en) * 2021-10-12 2022-01-11 工银科技有限公司 High-performance network long connection establishing method and device

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104009938A (en) * 2014-06-17 2014-08-27 合一网络技术(北京)有限公司 Method and system for long connections based on router level
CN104796387A (en) * 2014-01-21 2015-07-22 腾讯科技(深圳)有限公司 Communication method and device of long connection of network
CN105227398A (en) * 2015-09-08 2016-01-06 深圳创维-Rgb电子有限公司 Long method of attachment, system and its apparatus, terminal are shared in multi-service
WO2016054977A1 (en) * 2014-10-09 2016-04-14 腾讯科技(深圳)有限公司 Method and apparatus for interactive response
WO2016090995A1 (en) * 2014-12-10 2016-06-16 北京奇虎科技有限公司 Method of communication between page and long-connection server, and client end
CN105763634A (en) * 2016-04-14 2016-07-13 北京思特奇信息技术股份有限公司 Service realization method and device based on TCP long connection
CN108234149A (en) * 2016-12-09 2018-06-29 沈阳美行科技有限公司 Network request management method and device
US10432720B1 (en) * 2014-06-25 2019-10-01 Symantec Corporation Systems and methods for strong information about transmission control protocol connections
CN111314419A (en) * 2020-01-16 2020-06-19 广州酷狗计算机科技有限公司 Network request method and device
CN111414208A (en) * 2020-03-13 2020-07-14 百度在线网络技术(北京)有限公司 Application program starting method, device and equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104796387A (en) * 2014-01-21 2015-07-22 腾讯科技(深圳)有限公司 Communication method and device of long connection of network
CN104009938A (en) * 2014-06-17 2014-08-27 合一网络技术(北京)有限公司 Method and system for long connections based on router level
US10432720B1 (en) * 2014-06-25 2019-10-01 Symantec Corporation Systems and methods for strong information about transmission control protocol connections
WO2016054977A1 (en) * 2014-10-09 2016-04-14 腾讯科技(深圳)有限公司 Method and apparatus for interactive response
WO2016090995A1 (en) * 2014-12-10 2016-06-16 北京奇虎科技有限公司 Method of communication between page and long-connection server, and client end
CN105227398A (en) * 2015-09-08 2016-01-06 深圳创维-Rgb电子有限公司 Long method of attachment, system and its apparatus, terminal are shared in multi-service
CN105763634A (en) * 2016-04-14 2016-07-13 北京思特奇信息技术股份有限公司 Service realization method and device based on TCP long connection
CN108234149A (en) * 2016-12-09 2018-06-29 沈阳美行科技有限公司 Network request management method and device
CN111314419A (en) * 2020-01-16 2020-06-19 广州酷狗计算机科技有限公司 Network request method and device
CN111414208A (en) * 2020-03-13 2020-07-14 百度在线网络技术(北京)有限公司 Application program starting method, device and equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
DYLAN93: "Flutter集成gRPC", HTTPS://BLOG.CSDN.NET/WEIXIN_38951817/ARTICLE/DETAILS/88556360, 14 March 2019 (2019-03-14), pages 1 - 8 *
WEIXIN_38951817: "Android studio 集成 flutter SDK", HTTPS://BLOG.CSDN.NET/WEIXIN_38951817/ARTICLE/DETAILS/88556360, 14 March 2019 (2019-03-14), pages 1 - 3 *
圆胖肿: "使用flutter如何进行聊天功能的开发?", HTTPS://WWW.ZHIHU.COM/QUESTION/326672274/ANSWER/703043769, 2 June 2019 (2019-06-02), pages 1 - 2 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113923249A (en) * 2021-10-12 2022-01-11 工银科技有限公司 High-performance network long connection establishing method and device

Similar Documents

Publication Publication Date Title
EP3550892B1 (en) Method for network slice selection, user equipment, and network device
KR102116401B1 (en) Cross resource subscription to M2M service layer
KR101984413B1 (en) Systems and methods for enabling access to third party services via service layer
EP2680500B1 (en) Application discovery
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
CN107222326B (en) Access method, configuration method and device for service between devices
CN110958281B (en) Data transmission method and communication device based on Internet of things
US20210274328A1 (en) Internet of vehicles message notification method and apparatus
JP6966675B2 (en) Transmission and display of screen content
WO2016187515A1 (en) Methods and apparatus for analyzing and grouping service layer subscriptions and notifications for enhanced efficiency
US20150256622A1 (en) Connection management device, communication system, connection management method, and computer program product
WO2017101186A1 (en) Method for establishing wireless connection for application of user equipment
US9628567B2 (en) Methods and systems for efficient discovery of devices in a peer-to-peer network
JP2019525604A (en) Network function NF management method and NF management apparatus
CN111163130A (en) Network service system and data transmission method thereof
CN112188227A (en) Streaming media data distribution method and device
US20230262143A1 (en) Relocation of application context to edge data network
CN110582998A (en) Group communication method and device, computer storage medium and computer equipment
US10499311B2 (en) Method and apparatus for implementing network sharing
CN112383617A (en) Method, device, terminal equipment and medium for long connection
KR101921275B1 (en) Method and system of file transfer using device-to-device communication technique in messenger
CN110943975B (en) Service registration method, device, computer equipment and storage medium
CN109327517B (en) Method and equipment for acquiring network state of wireless access point
CN107948232B (en) Hook API-based proxy implementation method, data transmission method, device and system
CN107211479B (en) Method and device for selecting access network

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