Plug-in process communication method and device, electronic equipment and storage medium
By filtering the target plug-in instances in the plug-in instance and starting the plug-in process, the problem of incompatibility of plug-in process communication methods on multiple system platforms is solved, and the communication between the browser web page and the local plug-in process is realized, improving the efficiency and reliability of communication.
Patent Information
- Application Number
- CN202510183388.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-05-16
AI Technical Summary
In the prior art, the plug-in process communication method is incompatible with multiple system platforms, resulting in the inability to communicate between the browser web page and the local plug-in process, which limits the performance of Windows system functions.
By filtering the target plug-in instances in the plug-in instances, and starting the target plug-in process according to the plug-in process startup request, the communication between the browser web page and the local plug-in process is achieved.
It solves the problem that plug-in process communication methods are incompatible on multiple system platforms, enhances universality, avoids the problem of inability to start the plug-in process due to error selection of plug-in instances, and improves the execution efficiency and reliability of plug-in process communication.
Smart Images

Figure CN120010956A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of plug-in management, and in particular to a plug-in process communication method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of information technology, information innovation has become an important strategy to promote information security and the independent control of information technology. In this context, domestic substitution has become a key path for enterprises and institutions to upgrade their information technology. However, many enterprises and institutions are still using Windows systems, which carry a large number of core businesses. Therefore, in the process of promoting domestic transformation, the functions of these systems need to be brought into play. In the Linux system, the method for implementing system function calls mainly relies on the Dbus-related technology stack. A plug-in management platform is built through the Dbus-related technology stack, which can implement the call of local functions. Through this platform, the browser can communicate with the local plug-in process and then call various functions provided by the local plug-in process. However, in the Windows system, the use of the Dbus-related technology stack is not supported, which limits the performance of Windows system functions. Therefore, providing a method for implementing communication between browser web pages and local plug-in processes that is common to multiple operating systems has become an urgent problem to be solved in the field of plug-in management technology. Summary of the invention
[0003] The present invention provides a plug-in process communication method, device, electronic device and storage medium. The present invention avoids the problem of being unable to start a plug-in process due to incorrect plug-in instance selection, solves the problem of incompatibility of the plug-in process communication method in the prior art on multiple system platforms, and enhances the versatility of the plug-in process communication method.
[0004] According to one aspect of an embodiment of the present invention, a plug-in process communication method is provided, comprising:
[0005] According to the plug-in call request, a target plug-in instance corresponding to the plug-in instance call request is filtered in the plug-in instance set;
[0006] Determine that the target plug-in instance is successfully filtered, and obtain the plug-in process start request corresponding to the target plug-in instance;
[0007] According to the plug-in process start request, the plug-in process corresponding to the target plug-in instance is started.
[0008] Another aspect of an embodiment of the present invention provides a plug-in process communication device, including:
[0009] An instance screening module is used to screen a target plug-in instance corresponding to a plug-in call request in a plug-in instance set according to the plug-in call request;
[0010] A request acquisition module is used to determine that the target plug-in instance is successfully screened and obtain a plug-in process startup request corresponding to the target plug-in instance;
[0011] The process startup module is used to start the plug-in process corresponding to the target plug-in instance according to the plug-in process startup request.
[0012] Another aspect of an embodiment of the present invention provides an electronic device, including:
[0013] at least one processor;
[0014] and a memory communicatively coupled to the at least one processor;
[0015] The memory stores a computer program executable by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the plug-in process communication method of any embodiment of the present invention.
[0016] Another aspect of an embodiment of the present invention provides a computer-readable storage medium, including:
[0017] Computer instructions, the computer instructions are used to enable a processor to execute the plug-in process communication method of any embodiment of the present invention.
[0018] In an embodiment of the present invention, a plug-in call request for screening a target plug-in instance is obtained, and the plug-in instance can be screened in a plug-in instance set formed by plug-in instance registration according to the information contained in the plug-in call request, and the plug-in instance matching the information contained in the plug-in call request can be used as the target plug-in instance. When the target plug-in instance is successfully screened out from the plug-in instance set, a plug-in process start request for starting a plug-in process can be constructed according to the information corresponding to the target plug-in instance, and the plug-in process corresponding to the target plug-in instance can be started according to the information contained in the plug-in process start request. In an embodiment of the present invention, the target plug-in instance can be accurately located in the plug-in instance set according to the plug-in call request, avoiding the problem of being unable to start the plug-in process due to an error in the selection of the plug-in instance. By providing a communication mechanism for the plug-in process based on the plug-in instance set, there is no need to communicate with the plug-in process via a data bus, and the execution efficiency of the plug-in process communication can be improved. The plug-in process in the normal life cycle is provided according to the plug-in instance set, and the reliability of the plug-in communication can be improved.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 This is a flow chart of a plug-in process communication method provided according to the first embodiment of the present invention;
[0022] Figure 2 is a flow chart of another plug-in process communication method provided according to the second embodiment of the present invention;
[0023] Figure 3 This is a registration flow chart of the communication between a browser webpage and a local plug-in process provided by the third embodiment of the present invention;
[0024] Figure 4 This is a call flow chart of communication between a front-end browser webpage and a local plug-in process provided by Embodiment 3 of the present invention;
[0025] Figure 5 This is an architecture diagram of communication between a front-end browser web page and a local plug-in process provided by Embodiment 3 of the present invention;
[0026] Figure 6 It is a schematic diagram of the structure of a device for implementing a plug-in process communication method according to an embodiment of the present invention;
[0027] Figure 7 The invention is a block diagram of an electronic device for executing a plug-in process communication method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] Embodiment 1
[0031] Figure 1 A flowchart of a plug-in process communication method is provided for the first embodiment of the present invention. The embodiment of the present invention can be applied to the case where a front-end browser webpage communicates with a local plug-in process. The method can be executed by a plug-in process communication device. The plug-in process communication device can be implemented in the form of hardware and / or software. The plug-in process communication device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0032] S101: Filter a target plug-in instance corresponding to the plug-in call request from a plug-in instance set according to the plug-in call request.
[0033] Among them, the plug-in call request can be understood as a signal for filtering target plug-in instances. The plug-in call request may include information required for filtering target plug-in instances. For example, the plug-in call request includes at least plug-in instance information, and may also include caller information and / or call time information, etc. It can be understood that the plug-in call request can be obtained via the network based on the network transmission protocol, and the network transmission protocol may include: WebSocket protocol or hypertext transfer protocol, etc.
[0034] A plug-in instance set can be understood as a collection formed through plug-in instance registration. For example, the plug-in instance set may include: all registered plug-in instances and / or all registered instance information and other data. It can be understood that the plug-in instance is a dynamically manageable collection that supports dynamic updates, that is, the plug-in instance set can be updated by registering the newly created plug-in instance to the plug-in instance set through a registration mechanism. The registration mechanism may include: a function registration mechanism or an object registration mechanism and other mechanisms.
[0035] The target plug-in instance can be understood as the plug-in instance that matches the plug-in call request in the plug-in instance set. For example, the target plug-in instance at least includes: all the codes required to execute the specified preset function, wherein the plug-in instance can be understood as a specific entity of the plug-in at runtime. It can be understood that the operation cycle of the plug-in instance can include: creation, loading, execution, unloading and destruction stages.
[0036] Specifically, a plug-in call request for filtering target plug-in instances is obtained, and plug-in instances can be filtered in a plug-in instance set formed by plug-in instance registration according to information contained in the plug-in call request, and a plug-in instance matching the information contained in the plug-in call request can be used as a target plug-in instance.
[0037] For example, the step of screening the plug-in instances in the plug-in instance set formed by the plug-in instance registration according to the information contained in the plug-in call request may include: extracting the plug-in instance information in the plug-in call request, matching the plug-in instance information with the instance information corresponding to all the plug-in instances contained in the plug-in instance set, and after a successful match, using the plug-in instance corresponding to the plug-in instance information as the target plug-in instance.
[0038] S102: Determine that the target plug-in instance is successfully screened, and obtain a plug-in process start request corresponding to the target plug-in instance.
[0039] Among them, the plug-in process start request can be understood as a signal for starting the plug-in process. The plug-in call request may include information required to start the plug-in process. For example, the plug-in process start request may include: plug-in process identification, executable path, dependency list and other information.
[0040] Specifically, when the target plug-in instance is successfully screened out from the plug-in instance set, a plug-in process start request for starting the plug-in process may be constructed according to information corresponding to the target plug-in instance.
[0041] For example, the steps of constructing a plug-in process startup request for starting a plug-in process based on information corresponding to a target plug-in instance may include: obtaining a preset request generation rule and plug-in instance information corresponding to the target plug-in instance, extracting plug-in process startup parameters from the plug-in instance information, and using the obtained preset request generation rule to encapsulate the plug-in process startup parameters into a plug-in process startup request.
[0042] S103: Start the plug-in process corresponding to the target plug-in instance according to the plug-in process start request.
[0043] Among them, the plug-in process can be understood as a program running instance that runs the plug-in. It can be understood that each plug-in process can have its own independent memory space and / or system resources to ensure the stable operation of the plug-in.
[0044] Specifically, a plug-in process start request is obtained, and the plug-in process corresponding to the target plug-in instance can be started according to information included in the plug-in process start request.
[0045] For example, after starting the plug-in process corresponding to the target plug-in instance according to the information included in the plug-in process start request, the method may further include: using the plug-in process to execute the code included in the target plug-in instance to complete the call of the specified function.
[0046] For example, a plug-in process start request can be obtained through a local inter-process communication protocol or a Google remote procedure call protocol to start the plug-in process.
[0047] For example, the step of starting the plug-in process corresponding to the target plug-in instance according to the plug-in process start request may include: encapsulating the plug-in process start request into a plug-in process start instruction according to a preset inter-process communication rule, and starting the plug-in process using the plug-in process start instruction.
[0048] In an embodiment of the present invention, a plug-in call request for screening a target plug-in instance is obtained. The plug-in instance can be screened in a plug-in instance set formed by plug-in instance registration according to the information contained in the plug-in call request. The plug-in instance matching the information contained in the plug-in call request can be used as the target plug-in instance. When the target plug-in instance is successfully screened out from the plug-in instance set, a plug-in process start request for starting a plug-in process can be constructed according to the information corresponding to the target plug-in instance. The plug-in process corresponding to the target plug-in instance can be started according to the information contained in the plug-in process start request. In an embodiment of the present invention, the target plug-in instance can be accurately located in the plug-in instance set according to the plug-in call request, avoiding the problem of being unable to start the plug-in process due to an error in plug-in instance selection. By providing a communication mechanism for the plug-in process based on the plug-in instance set, there is no need to communicate with the plug-in process via a data bus, which can improve the execution efficiency of the plug-in process communication. The plug-in process in a normal life cycle is provided according to the plug-in instance set, which can improve the reliability of the plug-in communication. On the basis of the above embodiment, the embodiment of the present invention also includes: using the plug-in process to execute the code corresponding to the target plug-in instance to realize the preset function of the plug-in process corresponding to the target plug-in.
[0049] The target plug-in may be understood as a software component with preset functions. For example, the types of the target plug-in may include: an image processing plug-in or a data analysis plug-in.
[0050] Preset functions refer to the functions that have been determined and planned at the beginning of the design of the target plug-in. For example, the preset functions of an image processing plug-in may include: image scaling or image rotation, etc., and the preset functions of a data analysis plug-in may include: data import or data visualization, etc.
[0051] Specifically, after starting the plug-in process, the plug-in process can be used to load and run the code associated with the target plug-in instance. By executing the code, the preset functions that have been determined and planned at the beginning of the design of the target plug-in can be realized.
[0052] On the basis of the above-mentioned embodiments, an embodiment of the present invention filters a target plug-in instance corresponding to a plug-in instance call request in a plug-in instance set according to a plug-in call request, which includes: obtaining a plug-in instance creation request, creating a plug-in instance according to the plug-in instance creation request, and generating instance information corresponding to the plug-in instance; registering the plug-in instance and the instance information corresponding to the plug-in instance to a preset data structure to form a plug-in instance set.
[0053] Among them, the plug-in instance creation request can be understood as a signal for creating a plug-in instance. The plug-in instance creation request may include information required to create the plug-in instance. For example, the plug-in instance creation request may include: initialization plug-in instance parameters or plug-in instance configuration parameters and other information. It can be understood that the plug-in instance creation request is similar to the plug-in call request, and the plug-in instance creation request can also be obtained via the network based on the network transmission protocol. The network transmission protocol may include: WebSocket protocol or hypertext transfer protocol, etc.
[0054] A plug-in instance can be understood as a running entity of the plug-in code, which is an instantiation of the plug-in function. For example, the running cycle of a plug-in instance may include: creation, loading, execution, unloading and destruction.
[0055] The instance information can be understood as a series of data used to describe the properties of the plug-in instance. For example, the instance information may include data such as the creation time of the plug-in instance and / or the resource usage of the plug-in instance.
[0056] The preset data structure can be understood as a pre-configured organization that can be used to store data. For example, the types of the preset data structure may include: array type or linked list type, etc. The preset data structure at least includes: a plug-in instance and instance information corresponding to the plug-in instance.
[0057] Specifically, before filtering the target plug-in instance corresponding to the plug-in instance call request in the plug-in instance set according to the plug-in call request, the following steps may also be included: obtaining a plug-in instance creation request for creating a plug-in instance, wherein the plug-in instance creation request may include information required for creating the plug-in instance, a corresponding plug-in instance may be created according to the information included in the plug-in instance creation request, instance information related to the plug-in instance may be generated during the creation of the plug-in instance, the created plug-in instance and its corresponding instance information may be registered in a preset data structure for storing data to form a plug-in instance set, and the plug-in instance may be subsequently managed based on the plug-in instance set.
[0058] Embodiment 2
[0059] Figure 2 This is a flow chart of another plug-in process communication method provided by Embodiment 2 of the present invention. Based on the above embodiments, this embodiment of the present invention provides another plug-in process communication method. Figure 2 As shown, the method includes:
[0060] S201: Receive a plug-in calling request transmitted by a browser page, and extract plug-in instance information in the plug-in calling request.
[0061] The plug-in instance information may be understood as a series of data used to describe the properties of the target plug-in instance. For example, the plug-in instance information may include data such as the creation time of the target plug-in instance and / or the resource usage of the target plug-in instance.
[0062] Specifically, a plug-in calling request transmitted by a browser page may be obtained, and the obtained plug-in calling request may be parsed to extract plug-in instance information for describing properties of a target plug-in instance.
[0063] For example, the method of parsing the obtained plug-in call request may include: parsing the plug-in call request using a method or function included in a WebSocket library or parsing the plug-in call request using a method or function included in a hypertext transfer protocol library.
[0064] S202: Match the plug-in instance information with the instance information in the plug-in instance set, and use the plug-in instance corresponding to the instance information matching the plug-in instance information as the target plug-in instance.
[0065] Specifically, all plug-in instances registered in the plug-in instance set and instance information associated with each plug-in instance can be obtained, all instance information contained in the plug-in instance set can be traversed, and the plug-in instance information can be matched using the instance information. When the matching situation is that the plug-in instance information is successfully matched, the plug-in instance corresponding to the plug-in instance information can be used as the target plug-in instance.
[0066] For example, the method of matching instance information, plug-in instance and plug-in instance information may include: a hash value matching method or a regular expression matching method.
[0067] S203: extract the plug-in instance information of the target plug-in instance, and extract the plug-in process startup parameters in the plug-in instance information, wherein the plug-in process startup parameters at least include: a plug-in process identifier, an executable path, and a dependency list.
[0068] The plug-in process startup parameters refer to a series of data required to start the plug-in process, which can be used to guide how to correctly start the plug-in process. For example, the plug-in process startup parameters include but are not limited to: plug-in process ID, executable path, and dependency list.
[0069] The plug-in process identifier can be understood as an identifier for uniquely identifying a plug-in process, and can be used to distinguish different plug-in processes. For example, the plug-in process identifier can be in the form of a string or a number.
[0070] The executable path refers to the location of the plug-in process executable file in the file system and can be used to guide the startup of the plug-in process at the corresponding location.
[0071] The dependency list refers to the collection of all external resources required by the plug-in process when it starts. For example, external resources may include: configuration files, database files, or database services.
[0072] Specifically, the plug-in instance information in the plug-in call request is obtained, and the plug-in instance information can be parsed. At least three plug-in process startup parameters required to start the plug-in process can be extracted from the parsed plug-in instance information, including a plug-in process identifier used to uniquely identify the plug-in process, an executable path indicating the location of the plug-in process executable file in the file system, and a list of dependencies required for the plug-in process to start.
[0073] S204: Generate a plug-in process startup request based on the plug-in process startup parameters and preset request generation rules, wherein the preset request generation rules at least include: parameter format conversion rules, parameter value encoding rules, and parameter value verification rules.
[0074] Among them, the preset request generation rule can be understood as a standard for encapsulating the plug-in process startup parameters into a plug-in process startup request. For example, the preset request generation rule includes but is not limited to: parameter format conversion rules, parameter value encoding rules, parameter value verification rules, etc. It can be understood that the parameter format conversion rule refers to a standard for format conversion of the plug-in process startup parameters, which can be used to ensure the accuracy of the data format in the plug-in process startup request, the parameter value encoding rule refers to a standard for encoding the plug-in process startup parameters, which can be used to ensure the integrity of the data in the plug-in process startup request, and the parameter value verification rule refers to a standard for verifying the plug-in process startup parameters, which can be used to ensure the security of the data in the plug-in process startup request.
[0075] Specifically, the plug-in process startup parameters in the plug-in instance information and the preset request generation rules including at least three types of rules, namely, parameter format conversion rules, parameter value encoding rules, and parameter value verification rules are obtained. The plug-in process startup parameters can be encapsulated based on the preset request generation rules to form a plug-in process startup request. It can be understood that when the plug-in process startup parameters are encapsulated based on the preset request generation rules, at least format conversion, parameter value encoding, parameter value verification and other operations are performed on the plug-in process startup parameters.
[0076] S205. Encapsulate the plug-in process start request into a plug-in process start instruction according to preset inter-process communication rules, wherein the preset inter-process communication rules at least include: Google remote procedure call communication rules.
[0077] Among them, the preset inter-process communication rules can be understood as a standard for converting a plug-in process startup request into a plug-in process startup instruction. For example, the preset inter-process communication rules at least include: Google Remote Procedure Call (GRPC) communication rules. It can be understood that GRPC communication rules refer to a communication rule based on the GRPC framework, which can be used to guide how to use the GRPC framework for inter-process communication.
[0078] The plug-in process start instruction can be understood as a signal suitable for transmission between plug-in processes, which can be used to start the plug-in process. It can be understood that the information required for starting the plug-in process contained in the plug-in process start instruction has been encapsulated into information suitable for transmission between plug-in processes.
[0079] Specifically, the preset inter-process communication rules are obtained, wherein the preset inter-process communication rules include at least one GRPC communication rule based on the GRPC framework. The obtained preset inter-process communication rules can be used to encapsulate the plug-in process startup request to form a plug-in process startup instruction that is suitable for inter-process transmission and is used to start the plug-in process. Subsequent operations can be performed based on the plug-in process startup instruction.
[0080] S206: Start the plug-in process according to the plug-in process start instruction.
[0081] Specifically, the plug-in process start instruction is obtained, and the corresponding plug-in process can be started according to the information included in the obtained plug-in process start instruction.
[0082] According to an embodiment of the present invention, a plug-in call request transmitted by a browser page can be obtained, the obtained plug-in call request can be parsed, plug-in instance information used to describe the properties of a target plug-in instance can be extracted, all plug-in instances registered in a plug-in instance set and instance information associated with each plug-in instance can be obtained, all instance information contained in the plug-in instance set can be traversed, the plug-in instance information can be matched using the instance information, and when the matching situation is that the plug-in instance information is successfully matched, the plug-in instance corresponding to the plug-in instance information can be used as the target plug-in instance, the plug-in instance information can be parsed, and at least three plug-in process startup parameters, including a plug-in process identifier required for uniquely identifying the plug-in process when starting the plug-in process, an executable path indicating the location of the plug-in process executable file in the file system, and a dependency list required for the plug-in process when starting, can be extracted from the parsed plug-in instance information to obtain the plug-in instance information. The plug-in process startup parameters within the system, as well as the preset request generation rules including at least three types of rules such as parameter format conversion rules, parameter value encoding rules and parameter value verification rules, can be encapsulated based on the preset request generation rules to form a plug-in process startup request. It can be understood that when the plug-in process startup parameters are encapsulated based on the preset request generation rules, at least the plug-in process startup parameters are format converted, parameter value encoded and parameter value verified to obtain the preset inter-process communication rules, wherein the preset inter-process communication rules include at least one GRPC communication rule based on the GRPC framework. The plug-in process startup request can be encapsulated using the obtained preset inter-process communication rules to form a plug-in process startup instruction that is suitable for transmission between plug-in processes and is used to start the plug-in process. The corresponding plug-in process can be started according to the information contained in the obtained plug-in process startup instruction. The embodiment of the present invention can accurately locate the target plug-in instance in the plug-in instance set by matching the plug-in instance information in the plug-in call request with the instance information in the plug-in instance set, thereby ensuring the accuracy of the plug-in instance selection and avoiding the problem of being unable to start the plug-in process due to the wrong plug-in instance selection. By encapsulating the plug-in process start request into a plug-in process start instruction suitable for inter-process communication, information can be transmitted more efficiently between processes, thereby improving the communication efficiency of the plug-in process communication method.
[0083] Based on the above embodiments, an embodiment of the present invention starts a plug-in process according to a plug-in process start instruction, including: calling a preset function interface to obtain the plug-in process start instruction, and starting the plug-in process based on the plug-in process start instruction, wherein the interface name of the preset function interface reflects the function corresponding to the plug-in process.
[0084] Among them, the preset function interface can be understood as a programming interface, through which the preset function interface can interact with the plug-in process. For example, the operating environment of the preset function interface may include: front-end browser environment or local operating system environment, and the design elements of the preset function interface may include: interface name or parameter list.
[0085] Specifically, a preset function interface can be called to receive a plug-in process calling instruction, and a corresponding plug-in process can be started based on the received plug-in process calling instruction. When designing the preset function interface, it is necessary to ensure that the interface name of the preset function interface can clearly and concisely express the specific function of the plug-in corresponding to the plug-in process.
[0086] Embodiment 3
[0087] Based on the above embodiments, the embodiment of the present invention provides a method for communicating between a front-end browser webpage and a plug-in process. The method may include a registration process and a calling process. In the registration process stage, such as Figure 3 As shown, a plug-in management platform can be created in the operating system, wherein the plug-in management platform includes: a plug-in management center and a Google Remote Procedure Call client (Google Remote Procedure Call, GRPC), and the plug-in management platform can establish a connection with the front-end browser web page through the WebSocket protocol. The plug-in management center of the plug-in management platform receives the plug-in instance creation request generated on the front-end browser web page, and the plug-in management platform verifies the plug-in information contained in the plug-in instance creation request. After determining that the verification is passed, the fork / reattach command in the plug-in management center can be called to execute the binary file related to the above plug-in information to create a plug-in process start request. The plug-in process can be initialized based on the plug-in process start request to start the plug-in process. After determining that the plug-in process is started, the GRPC server can be started to create a plug-in instance and generate corresponding instance information. The generated instance information is returned to the GRPC client through the GRPC service, and the GRPC client registers the created plug-in instance and instance information in the plug-in management center. In addition, when the plug-in process is started, a handshake message is generated, wherein the handshake message includes information that the plug-in instance is started. The handshake message is returned to the plug-in management platform. The plug-in management platform responds to the handshake message and starts the remote procedure call client configured in the plug-in management platform. The remote procedure call client establishes a communication connection with the remote procedure call server and registers the created plug-in instance and the corresponding instance information generated to the plug-in management center.
[0088] like Figure 4As shown, in the calling process stage, the plug-in management center of the plug-in management platform can be used to receive the plug-in calling request generated in the front-end browser web page, the plug-in information in the plug-in calling request can be verified in the plug-in management center, and after determining that the verification has passed, the plug-in instance corresponding to the target plug-in information in the plug-in management center can be loaded by calling the function interface, and after determining that the plug-in instance is loaded, the plug-in calling request can be encapsulated into a plug-in calling instruction based on the GRPC communication rules, and the plug-in calling instruction can be used as a GRPC instruction to send the GRPC instruction to the GRPC client. The GRPC client passes the GRPC instruction to the plug-in process through the GRPC server, and starts the plug-in process in response to the GRPC instruction to implement the calling of the plug-in function, and the calling result can be returned to the front-end browser web page.
[0089] Based on the above embodiments, the embodiment of the present invention further provides an architecture diagram of the communication between a browser webpage and a local plug-in process, such as Figure 5 As shown in the architecture diagram, WebSocket protocol management, plug-in instance management, plug-in management, GRPC client management and request instruction conversion can be implemented on the plug-in management process side, and plug-in instance creation, information registration, handshake information output, heartbeat interface, GRPC server, function interface call and other modules are provided on the plug-in process side. It can be understood that the plug-in management process side and the plug-in process side interact through a communication connection.
[0090] Embodiment 4
[0091] Figure 6 A device capable of executing a plug-in process communication method is provided in Embodiment 4 of the present invention, such as Figure 6 As shown, the device comprises:
[0092] An instance screening module 301 is used to screen a target plug-in instance corresponding to a plug-in call request from a plug-in instance set according to the plug-in call request;
[0093] The request acquisition module 302 is used to determine whether the target plug-in instance is successfully screened and to acquire a plug-in process start request corresponding to the target plug-in instance;
[0094] The process starting module 303 is used to start the plug-in process corresponding to the target plug-in instance according to the plug-in process starting request.
[0095] In an embodiment of the present invention, a plug-in call request for screening a target plug-in instance is obtained, and the plug-in instance can be screened in a plug-in instance set formed by plug-in instance registration according to the information contained in the plug-in call request, and the plug-in instance matching the information contained in the plug-in call request can be used as the target plug-in instance. When the target plug-in instance is successfully screened out from the plug-in instance set, a plug-in process start request for starting a plug-in process can be constructed according to the information corresponding to the target plug-in instance, and the plug-in process corresponding to the target plug-in instance can be started according to the information contained in the plug-in process start request. In an embodiment of the present invention, the target plug-in instance can be accurately located in the plug-in instance set according to the plug-in call request, avoiding the problem of being unable to start the plug-in process due to an error in the selection of the plug-in instance. By providing a communication mechanism for the plug-in process based on the plug-in instance set, there is no need to communicate with the plug-in process via a data bus, and the execution efficiency of the plug-in process communication can be improved. The plug-in process in the normal life cycle is provided according to the plug-in instance set, and the reliability of the plug-in communication can be improved.
[0096] On the basis of the above embodiment, the embodiment of the present invention further includes: using the plug-in process to execute the code corresponding to the target plug-in instance, so as to realize the preset function of the plug-in process corresponding to the target plug-in.
[0097] On the basis of the above-mentioned embodiments, the instance screening module 301 of the embodiment of the present invention includes: an information generation unit, which is used to obtain a plug-in instance creation request, create a plug-in instance according to the plug-in instance creation request, and generate instance information corresponding to the plug-in instance; a set forming unit, which is used to register the plug-in instance and the instance information corresponding to the plug-in instance to a preset data structure to form the plug-in instance set.
[0098] Based on the above embodiment, the instance screening module 301 of the embodiment of the present invention is specifically used to receive a plug-in call request transmitted by a browser page, and extract the plug-in instance information of the target plug-in instance in the plug-in call request;
[0099] The plug-in instance information is matched with the instance information in the plug-in instance set, and the plug-in instance corresponding to the instance information matching the plug-in instance information is used as the target plug-in instance.
[0100] Based on the above embodiment, the request acquisition module 302 in the embodiment of the present invention is specifically used for:
[0101] Extracting the plug-in instance information of the target plug-in instance, and extracting the plug-in process startup parameters in the plug-in instance information, wherein the plug-in process startup parameters at least include: a plug-in process identifier, an executable path, and a dependency list;
[0102] A plug-in process startup request is generated based on the plug-in process startup parameter and a preset request generation rule, wherein the preset request generation rule at least includes: a parameter format conversion rule, a parameter value encoding rule, and a parameter value verification rule.
[0103] Based on the above embodiments, the process startup module 303 of the embodiment of the present invention includes: an instruction encapsulation unit, which is used to encapsulate the plug-in process startup request into a plug-in process startup instruction according to the preset inter-process communication rules, wherein the preset inter-process communication rules at least include: Google remote procedure call communication rules; a process startup unit, which is used to start the plug-in process according to the plug-in process startup instruction.
[0104] Based on the above embodiments, the process startup unit of the embodiment of the present invention is specifically used to call a preset function interface to obtain a plug-in process startup instruction, and start the plug-in process based on the plug-in process startup instruction, wherein the interface name of the preset function interface reflects the function corresponding to the plug-in process.
[0105] Embodiment 5
[0106] Embodiments of the present invention provide an electronic device for executing a plug-in process communication method, a computer-readable storage medium, and a computer program product.
[0107] Figure 7 A schematic diagram of a structure of an apparatus that can be used to implement an embodiment of the present invention is shown. The apparatus is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The apparatus may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown in the embodiments of the present invention, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present invention described and / or required herein.
[0108] like Figure 7As shown, the device includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the ROM 12 or the computer program loaded from the storage unit 18 to the RAM 13. In the RAM 13, various programs and data required for the operation of the device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0109] A number of components in the device are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0110] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit, a graphics processing unit, various special artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, for example, the plug-in process communication method.
[0111] In some embodiments, the plug-in process communication method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps based on the plug-in process communication method may be performed. Alternatively, in other embodiments, the processor 11 may be configured as the plug-in process communication method in any other appropriate manner (e.g., by means of firmware).
[0112] Various implementations of the systems and techniques described above in the embodiments of the present invention may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays, application specific integrated circuits, application specific standard products, systems on a chip, load programmable logic devices, computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: being implemented in one or more computer programs, which may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general programmable processor, which may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0113] The computer programs for implementing the methods of the embodiments of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0114] In the context of an embodiment of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on a device having: a display device (e.g., a cathode ray tube or a liquid crystal display monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including: acoustic input, voice input, or tactile input).
[0116] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area networks, wide area networks, blockchain networks, and the Internet.
[0117] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private server services.
[0118] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0119] The above specific implementations do not constitute a limitation on the protection scope of the embodiments of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A plug-in process communication method, characterized in that: The method comprises: According to the plug-in call request, a target plug-in instance corresponding to the plug-in call request is selected from the plug-in instance set; Determine that the target plug-in instance is successfully screened, and obtain a plug-in process start request corresponding to the target plug-in instance; According to the plug-in process start request, the plug-in process corresponding to the target plug-in instance is started.
2. The method according to claim 1, characterized in that: The method further comprises: The plug-in process is used to execute the code corresponding to the target plug-in instance to implement the preset function of the target plug-in corresponding to the plug-in process.
3. The method according to claim 1, characterized in that: The step of filtering the target plug-in instance corresponding to the plug-in instance call request from the plug-in instance set according to the plug-in call request comprises: Obtain a plug-in instance creation request, create a plug-in instance according to the plug-in instance creation request, and generate instance information corresponding to the plug-in instance; The plug-in instance and the instance information corresponding to the plug-in instance are registered in a preset data structure to form the plug-in instance set.
4. The method according to claim 3, characterized in that: The step of screening the target plug-in instance corresponding to the plug-in instance call request from the plug-in instance set according to the plug-in call request includes: Receiving a plug-in calling request transmitted by a browser page, and extracting plug-in instance information of the target plug-in instance in the plug-in calling request; The plug-in instance information is matched with the instance information in the plug-in instance set, and the plug-in instance corresponding to the instance information matching the plug-in instance information is used as the target plug-in instance.
5. The method according to claim 1, characterized in that: The determining that the target plug-in instance is successfully screened and obtaining a plug-in process start request corresponding to the target plug-in instance includes: Extracting the plug-in instance information of the target plug-in instance, and extracting the plug-in process startup parameters in the plug-in instance information, wherein the plug-in process startup parameters at least include: a plug-in process identifier, an executable path, and a dependency list; The plug-in process startup request is generated based on the plug-in process startup parameter and a preset request generation rule, wherein the preset request generation rule at least includes: a parameter format conversion rule, a parameter value encoding rule and a parameter value verification rule.
6. The method according to claim 1, characterized in that: The starting the plug-in process corresponding to the target plug-in instance according to the plug-in process starting request includes: The plug-in process start request is encapsulated into a plug-in process start instruction according to a preset inter-process communication rule, wherein the preset inter-process communication rule at least includes: a Google remote procedure call communication rule; The plug-in process is started according to the plug-in process starting instruction.
7. The method according to claim 6, characterized in that: The starting the plug-in process according to the plug-in process starting instruction includes: The preset function interface is called to obtain the plug-in process start instruction, and the plug-in process is started based on the plug-in process start instruction, wherein the interface name of the preset function interface reflects the function corresponding to the plug-in process.
8. A plug-in process communication device, characterized in that: The device comprises: An instance screening module, used to screen a target plug-in instance corresponding to the plug-in call request from a plug-in instance set according to the plug-in call request; A request acquisition module, used to determine that the target plug-in instance is successfully screened, and obtain a plug-in process start request corresponding to the target plug-in instance; The process starting module is used to start the plug-in process corresponding to the target plug-in instance according to the plug-in process starting request.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the plug-in process communication method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the plug-in process communication method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Plug-in process management method, related method and related device
CN110708366A
Plug-in running method and device, equipment and storage medium
CN113282347A
Resource access method, computing device and readable storage medium
CN114168937A
Plug-in calling method and device, electronic equipment and computer readable storage medium
CN117076159A