Event communication method and device, storage medium and electronic device

By obtaining and sending events in the event ring, sending them to the subprogram of the target application according to the event type, a hierarchical event group is established, which solves the problem of low communication efficiency caused by disordered event communication and achieves more efficient event communication.

CN115129487BActive Publication Date: 2025-08-19ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110336695.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-29
Publication Date
2025-08-19
Estimated Expiration
2041-03-29

AI Technical Summary

Technical Problem

In the prior art, event communication disorder results in low communication efficiency.

Method used

The first event sent by the main program of the target application is obtained in the first event ring, and send it to the subroutine of the target application according to the event type, and establish different event rings to achieve automated construction of a hierarchical event group.

Benefits of technology

By automatically building a hierarchical event group, the efficiency of event communication is improved and the problem of low communication efficiency caused by disordered event communication is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115129487B_ABST
    Figure CN115129487B_ABST
Patent Text Reader

Abstract

The present invention discloses an event communication method and device, a storage medium, and an electronic device. The method comprises: obtaining a first event sent by a main program of a target application in a first event loop, wherein the first event loop is the scope of first event communication and includes the main program of the target application and a subroutine of the target application; and sending the first event to the subroutine of the target application in the first event loop according to the type of the first event, thereby achieving the purpose of enabling target application management to establish different event loops in the target application and enabling events to communicate within the event loops, thereby achieving the technical effect of automatically constructing a hierarchical event group, and further solving the technical problem of low event communication efficiency caused by disordered event communication in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of event communication, and in particular to an event communication method and device, a storage medium, and an electronic device. Background Art

[0002] With the development of information technology, more and more events are being transmitted over the Internet. For example, based on the event type and event instructions, an event is sent from the event sender to the event receiver. This requires establishing an event channel between the event receiver and the event sender. However, in the related art, there is a lack of an effective automatic event communication mechanism during the event communication process.

[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0004] The embodiments of the present invention provide an event communication method and apparatus, a storage medium, and an electronic device to at least solve the technical problem in the prior art that event communication is disordered and thus has low efficiency.

[0005] According to one aspect of an embodiment of the present invention, an event communication method is provided, comprising: obtaining a first event sent by a main program of a target application in a first event loop, wherein the first event loop is the scope of the first event communication, and the first event loop includes the main program of the target application and a subroutine of the target application; and sending the first event to the subroutine of the target application in the first event loop according to the type of the first event.

[0006] Optionally, sending the first event to the subroutine of the target application in the first event ring according to the type of the first event includes: when the type of the first event is a directed communication type event, sending the first event in a directed manner to the main program of the target application; or when the type of the first event is a broadcast communication type event, sending the first event in a directed manner to the main program of the target application and the subroutine of the target application.

[0007] Optionally, before obtaining the first event sent by the main program of the target application in the first event ring, the method includes: obtaining second identification information of the second event ring where the main program of the target application is currently located, the second identification information is information identifying that the second event ring is different from the first event ring, and the second event ring is the communication range of the first event; determining first identification information based on the second identification information, wherein the first identification information is the identification information of the first event ring; and determining the communication range of the first event based on the first identification information.

[0008] Optionally, before obtaining the first event sent by the main program of the target application in the first event loop, the method also includes: when the target application manager is ready to start the target application, obtaining the first environment variable parameter for running the target application sent by the target application manager; the target application server updates the first environment variable parameter to a second environment variable parameter, wherein the target application server is used to prepare a running environment for the main program of the target application; the target application server creates an event group based on the second environment variable parameter, wherein the event group includes the first event loop.

[0009] Optionally, the target application server creates an event group according to the second environment variable parameter, including: the target application server calls a target interface to create the event group according to the second environment variable parameter.

[0010] Optionally, after the target application server creates the event group according to the second environment variable parameter, the method further includes: updating the first environment variable parameter in the target application manager to the second environment variable parameter.

[0011] Optionally, after the target application server creates an event group based on the second environment variable parameter, the method also includes: the target application server obtains the third event environment variable parameter of the second event to be added to the event group; and adds the second event to the event group based on the third event environment variable parameter.

[0012] Optionally, after adding the second event to the event group according to the third event environment variable parameter, the method further includes: after the subroutine of the target application is started by the main program of the target application, the main program of the target application passes the third event environment variable parameter of the second event to the subroutine of the target application.

[0013] According to another aspect of an embodiment of the present invention, an event communication device is also provided, including: a first acquisition unit, used to acquire a first event sent by the main program of the target application in a first event ring, wherein the first event ring is the scope of the first event communication, and the first event ring includes the main program of the target application and the subroutine of the target application; a first sending unit, used to send the first event to the subroutine of the target application in the first event ring according to the type of the first event.

[0014] Optionally, the first sending unit includes: a first sending module for sending the first event in a targeted manner to the main program of the target application when the type of the first event is a targeted communication type event; or a second sending module for sending the first event in a targeted manner to the main program of the target application and the subroutine of the target application when the type of the first event is a broadcast communication type event.

[0015] Optionally, the device includes: a second acquisition unit, used to obtain second identification information of the second event ring where the main program of the target application is currently located before obtaining the first event sent by the main program of the target application in the first event ring, the second identification information is information identifying that the second event ring is different from the first event ring, and the second event ring is the communication range of the first event; a first determination unit, used to determine the first identification information based on the second identification information, wherein the first identification information is the identification information of the first event ring; a second determination unit, used to determine the communication range of the first event based on the first identification information.

[0016] Optionally, the device also includes: a third acquisition unit, used to obtain the first environment variable parameter for running the target application sent by the target application manager when the target application manager prepares to start the target application before obtaining the first event sent by the main program of the target application in the first event loop; a first update unit, used by the target application server to update the first environment variable parameter to a second environment variable parameter, wherein the target application server is used to prepare a running environment for the main program of the target application; a creation unit, used by the target application server to create an event group according to the second environment variable parameter, wherein the event group includes the first event loop.

[0017] Optionally, the creation unit includes: a creation module, configured for the target application server to call a target interface to create the event group according to the second environment variable parameter.

[0018] Optionally, the device further includes: a second updating unit, configured to update the first environment variable parameters in the target application manager to the second environment variable parameters after the target application server creates the event group according to the second environment variable parameters.

[0019] Optionally, the device also includes: a fourth acquisition unit, which is used for the target application server to obtain the third event environment variable parameters of the second event to be added to the event group after the target application server creates the event group according to the second environment variable parameters; and a adding unit, which is used to add the second event to the event group according to the third event environment variable parameters.

[0020] Optionally, the device also includes: a transfer unit, which is used to add the second event to the event group according to the third event environment variable parameter, and after the subroutine of the target application is started by the main program of the target application, the main program of the target application transfers the third event environment variable parameter of the second event to the subroutine of the target application.

[0021] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the above-mentioned event communication method when running.

[0022] According to another aspect of an embodiment of the present invention, there is provided an electronic device including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the event communication method through the computer program.

[0023] In an embodiment of the present invention, a first event sent by a main program of a target application is obtained in a first event loop, wherein the first event loop is the scope of the first event communication and includes the main program of the target application and a subroutine of the target application; according to the type of the first event, the first event is sent to the subroutine of the target application in the first event loop, thereby achieving the purpose that in the target application, the target application management can establish different event loops and events can communicate in the event loops, thereby realizing the technical effect of automatically constructing a hierarchical event group, and further solving the technical problem in the prior art of low efficiency of event communication caused by disordered event communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0025] Figure 1 is a schematic diagram of an application environment of an optional event communication method according to an embodiment of the present invention;

[0026] Figure 2 is a flow chart of an optional event communication method according to an embodiment of the present invention;

[0027] Figure 3 is a structural block diagram of an optional event communication mechanism according to an embodiment of the present invention;

[0028] Figure 4 is a flow chart (1) of establishing an optional event communication mechanism according to an embodiment of the present invention;

[0029] Figure 5 This is a flowchart (II) of establishing an optional event communication mechanism according to an embodiment of the present invention;

[0030] Figure 6 is a schematic structural diagram of an optional event communication device according to an embodiment of the present invention;

[0031] Figure 7 FIG. 4 is a schematic structural diagram of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions 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 embodiments described 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 making creative efforts should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second", etc. in the description 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 numbers 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 clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] According to one aspect of an embodiment of the present invention, an event communication method is provided. Optionally, as an optional implementation, the event communication method can be applied to, but is not limited to, Figure 1 In the environment shown, there are terminal device 102, network 104 and server 106.

[0035] The server 106 obtains the first event sent by the main program of the target application in the first event loop, wherein the first event loop is the scope of the first event communication, and the first event loop includes the main program of the target application and the subroutine of the target application; according to the type of the first event, the first event is sent to the subroutine of the target application in the first event loop, thereby achieving the purpose that in the target application, the target application management can establish different event loops and events can communicate in the event loop, thereby realizing the technical effect of automatically constructing a hierarchical event group, and further solving the technical problem of low event communication efficiency caused by disordered event communication in the existing technology.

[0036] Optionally, the above event communication method may also be executed by the terminal device 102 , or may be executed collaboratively by the terminal device 102 and the server 106 .

[0037] Optionally, in this embodiment, the above-mentioned terminal device can be a terminal device configured with a target client, which can include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop computer, a tablet computer, a PDA, an MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client can be a video client, an instant messaging client, a browser client, an education client, etc. The above-mentioned network can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The above-mentioned server can be a single server, or it can be a server cluster composed of multiple servers, or a cloud server. The above is only an example, and this embodiment does not impose any limitation on this.

[0038] Alternatively, as an optional implementation, Figure 2 As shown, the above event communication method includes:

[0039] Step S202 : obtaining a first event sent by a main program of a target application in a first event loop, wherein the first event loop is a scope of first event communication and includes the main program of the target application and subroutines of the target application.

[0040] Step S204: sending the first event to a subroutine of a target application in the first event loop according to the type of the first event.

[0041] Optionally, in this embodiment, the above event communication method may include, but is not limited to, application-wide event communication within applications. Applications include, but are not limited to, instant messaging applications, video applications, and the like. An effective automatic event communication mechanism is established between AppManager / AppWaiter / AppMain(Sub).

[0042] Optionally, in this embodiment, the first event may include but is not limited to data, instruction, and other events. The first event loop may include at least AppManager, AppWaiter, and AppMain(Sub). In the first event loop, the subroutines of the application may include but are not limited to one or more. The type of the first event may be a directional event, that is, the event value can be sent to the subroutine in a targeted manner. The type of the first event may also be a broadcast event, which can be sent to the main program and / or subroutine.

[0043] Through the embodiments provided by the present application, the first event sent by the main program of the target application is obtained in the first event loop, wherein the first event loop is the scope of the first event communication, and the first event loop includes the main program of the target application and the subroutine of the target application; according to the type of the first event, the first event is sent to the subroutine of the target application in the first event loop, thereby achieving the purpose that in the target application, the target application management can establish different event loops and events can communicate in the event loop, thereby realizing the technical effect of automatically constructing a hierarchical event group, and further solving the technical problem of low event communication efficiency caused by disordered event communication in the prior art.

[0044] Optionally, based on the type of the first event, sending the first event to the subroutine of the target application in the first event ring may include: when the type of the first event is a directed communication type event, sending the first event in a directed manner to the main program of the target application; or when the type of the first event is a broadcast communication type event, sending the first event in a directed manner to the main program of the target application and the subroutine of the target application.

[0045] Optionally, before obtaining the first event sent by the main program of the target application in the first event ring, the above method may also include: obtaining the second identification information of the second event ring where the main program of the target application is currently located, the second identification information is information that identifies that the second event ring is different from the first event ring, and the second event ring is the communication range of the first event; determining the first identification information based on the second identification information, wherein the first identification information is the identification information of the first event ring; and determining the communication range of the first event based on the first identification information.

[0046] In this embodiment, the first event ring and the second event ring are event rings in an event group. An event group may include multiple event rings. Depending on the type of event, a first event may be communicated in the first event ring or in the second event ring. In other words, a first event may be communicated in any event ring in an event group depending on the type of event.

[0047] Among them, the event group number n is generated by AppManager, and AppWaiter completes N; AppWaiter sets the event group sub-number 1, creates a service that allows joining this event group, and updates it to AppManager, allowing it to join the event group; AppWaiter sets the event group number 0, passes it to AppMain, allowing it to join the event group, and AppWaiter becomes the exchange node between sub-groups 1 and 0; when AppMain creates more AppSub-n, it will temporarily enable the event group joining service and pass it to APpSub-n to let it join the event group.

[0048] Optionally, it is characterized in that before obtaining the first event sent by the main program of the target application in the first event loop, the above method may also include: when the target application manager is ready to start the target application, obtaining the first environment variable parameter for running the target application sent by the target application manager; the target application server updates the first environment variable parameter to a second environment variable parameter, wherein the target application server is used to prepare the running environment for the main program of the target application; the target application server creates an event group according to the second environment variable parameter, wherein the event group includes the first event loop.

[0049] In this embodiment, the first environment variable parameter may include but is not limited to AppManager preparing to start a certain APP and publishing to the environment variable (PubENV): "AppID=n, RingID=1".

[0050] Optionally, the target application server creates the event group according to the second environment variable parameter, which may include: the target application server calls the target interface to create the event group according to the second environment variable parameter.

[0051] Optionally, after the target application server creates the event group according to the second environment variable parameter, the above method may further include: updating the first environment variable parameter in the target application manager to the second environment variable parameter.

[0052] Optionally, after the target application server creates an event group according to the second environment variable parameter, the above method may also include: the target application server obtains the third event environment variable parameter of the second event to be added to the event group; and adds the second event to the event group according to the third event environment variable parameter.

[0053] Optionally, after adding the second event to the event group according to the third event environment variable parameter, the above method may also include: after the subroutine of the target application is started by the main program of the target application, the main program of the target application passes the third event environment variable parameter of the second event to the subroutine of the target application.

[0054] Optionally, the present application also provides an optional embodiment of a method for data-command-event hybrid communication.

[0055] like Figure 3 As shown in Figure 1, the structural diagram of the event communication mechanism is shown in Figure 1. Figure 3 As shown, an event communication mechanism is established between AppManager / AppWaiter / AppMain(Sub) to achieve effective transmission of events.

[0056] It should be noted that EventGroup-N represents an event group numbered "N", abbreviated as EG-N.

[0057] EventGroup-N: 0, wherein the event ring (EventRing, ER for short) numbered “0” in EG-N consists of the application’s main program AppMain and the application’s subprogram AppSub.

[0058] If AppMain delivers an event to "EG-N:0" (alias: Local), only the AppSub-1 and AppSub-2 members will receive the event.

[0059] AppMain can obtain the current ER value and expand the range of events it can receive by specifying "ER+1". For example, if AppMain delivers an event to "EG-N:1", if the event type is directed, only AppWaiter will receive the event. If the event type is broadcast, AppWaiter and AppSub-1 / 2 will also receive the event. Broadcast is the default.

[0060] EventGroup-N: 1, where the event ring (EventRing) numbered "1" in EG-N consists of: AppManager, AppWaiter, AppMain, and AppSub-1 / -2.

[0061] AppWaiter delivers events to "EG-N:1". By default, all events in the range of ER values less than or equal to the current ER value will receive the event. You can also specify to deliver the event only to this event ring.

[0062] like Figure 4 As shown in FIG, the flow chart of the event communication mechanism is established (I), and the specific process is described as follows.

[0063] 1) AppManager prepares to start an app and publishes to the environment variable (PubENV): "AppID=n, RingID=1";

[0064] 2) AppWaiter obtains from the environment variables (GetENV): "AppID=n, RingID=1", which are the basic parameters prepared by AppManager for AppWaiter to create the event group;

[0065] 3) AppWaiter uses the basic parameter "AppID=n", and AppWaiter prepares a new operating environment for AppMain (typically such as creating a process group), generates and updates "AppID=N";

[0066] 4) AppWaiter calls the CreateEventGroup interface to create an event group with the parameters "AppID=N, RingID=1" to obtain "pLinkEG-N-1";

[0067] 5) AppWaiter publishes the parameters "AppID=N, RingID=0" as environment variables (PutENV) and updates them to AppManager, updating its previous "AppID=n" to "AppID=N";

[0068] 6) AppManager obtains the updated "AppID=N", combines it with "RingID=1", calls the interface JoinEventGroup to join the event group, and obtains "pLinkEG-N-1";

[0069] 7) AppMain is started by AppWaiter, or started in the environment built by AppWaiter;

[0070] 8) AppMain obtains the parameters of the event group to be added from the environment variable (GetENV), "AppID=N, RingID=0", calls the interface JoinEventGroup to join the event group, and obtains "pLinkEG-N-0";

[0071] 9) AppSub-1 / -2 are subroutines started by AppMain. AppMain does not modify environment variables but only passes them to AppSub-1 / -2. Their subsequent behavior is consistent with AppMain. They are added to the event group and get "pLinkEG-N-0" respectively.

[0072] like Figure 5 As shown in FIG, the flow chart (II) of the event communication mechanism is established, and the specific process is described as follows.

[0073] 1) AppWaiter: Get "AppID=n" from AppManager, generate "AppID=N", and call the interface CreateEventGroup to create an event group (AppID=N, RingID=1);

[0074] 2) After AppWaiter successfully creates the event group, it starts the Service waiting to join the event group, waiting for AppManager and AppMain to connect and join this event group;

[0075] 3) AppWaiter updates the AppManager's join event group parameters through UpdateENV;

[0076] 4) AppWaiter passes AppMain's join event group parameters through PutENV;

[0077] 5) The event group parameters that AppWaiter passes to AppManager and AppMain mainly consist of "AppID=N and RingID=0 / 1". It can also pass "Token=X" for authentication when they join the event group, and pass "URI=PROTO: / / Address:Port / Path" for the destination address of the event group.

[0078] 5) When AppManager and AppMain respectively call the JoinEventGroup interface to join the event group created by AppWaiter, AppWaiter will take the Service offline after receiving their joining the event group;

[0079] 6) When AppMain creates AppSub-n, it adopts a similar strategy as AppWaiter;

[0080] 7) AppMain uses the parameters "AppID=N, RingID=0" added to AppWaiter to call the interface CreateEventGroup to create an event group and start the Service waiting to join the event group;

[0081] 8) AppSub-n obtains the event group parameters passed by AppMain through PutENV through GetENV, and calls the interface JoinEventGroup to join the event group created by AppMain;

[0082] 9) After AppMain receives the newly added AppSub-n, it will take the Service offline.

[0083] In this embodiment, the event group number n is generated by AppManager, and AppWaiter completes N; AppWaiter sets the event group sub-number 1, creates a service that allows joining this event group, and updates it to AppManager, allowing it to join the event group; AppWaiter sets the event group number 0, passes it to AppMain, allowing it to join the event group, and AppWaiter becomes the exchange node between sub-groups 1 and 0; when AppMain creates more AppSub-n, it will temporarily enable the event group joining service and pass it to APpSub-n to allow it to join the event group.

[0084] Through the embodiments provided in this application, an effective automatic event communication mechanism is established between AppManager / AppWaiter / AppMain(Sub), solving the problem of how to automatically construct a hierarchical event group.

[0085] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0086] According to another aspect of the embodiment of the present invention, an event communication device for implementing the above event communication method is also provided. Figure 6 As shown, the event communication device includes: a first acquiring unit 61 and a first sending unit 63 .

[0087] The first acquiring unit 61 is configured to acquire a first event sent by a main program of a target application in a first event loop, wherein the first event loop is a scope of first event communication and includes the main program of the target application and subroutines of the target application.

[0088] The first sending unit 63 is configured to send the first event to a subroutine of a target application in the first event ring according to the type of the first event.

[0089] Through the embodiment provided by the present application, the first acquisition unit 61 acquires the first event sent by the main program of the target application in the first event loop, wherein the first event loop is the scope of the first event communication, and the first event loop includes the main program of the target application and the subroutine of the target application; the first sending unit sends the first event to the subroutine of the target application in the first event loop according to the type of the first event, thereby achieving the purpose that in the target application, the target application management can establish different event loops and events can communicate in the event loop, thereby realizing the technical effect of automatically constructing a hierarchical event group, and further solving the technical problem of low event communication efficiency caused by disordered event communication in the prior art.

[0090] Optionally, the above-mentioned first sending unit 63 may include: a first sending module, used to send the first event in a targeted manner to the main program of the target application when the type of the first event is a targeted communication type event; or a second sending module, used to send the first event in a targeted manner to the main program of the target application and the subroutine of the target application when the type of the first event is a broadcast communication type event.

[0091] Optionally, the above-mentioned device may include: a second acquisition unit, used to obtain the second identification information of the second event ring where the main program of the target application is currently located before obtaining the first event sent by the main program of the target application in the first event ring, the second identification information is information identifying that the second event ring is different from the first event ring, and the second event ring is the communication range of the first event; a first determination unit, used to determine the first identification information based on the second identification information, wherein the first identification information is the identification information of the first event ring; the second determination unit, used to determine the communication range of the first event based on the first identification information.

[0092] Optionally, the above-mentioned device may include: a third acquisition unit, used to obtain the first environment variable parameter for running the target application sent by the target application manager when the target application manager prepares to start the target application before obtaining the first event sent by the main program of the target application in the first event loop; a first update unit, used for the target application server to update the first environment variable parameter to the second environment variable parameter, wherein the target application server is used to prepare the running environment for the main program of the target application; a creation unit, used for the target application server to create an event group according to the second environment variable parameter, wherein the event group includes the first event loop.

[0093] Optionally, the creation unit may include: a creation module, configured for the target application server to call a target interface to create an event group according to the second environment variable parameter.

[0094] Optionally, the apparatus may include: a second updating unit configured to update the first environment variable parameter in the target application manager to the second environment variable parameter after the target application server creates the event group according to the second environment variable parameter.

[0095] Optionally, the above-mentioned device may include: a fourth acquisition unit, which is used for the target application server to obtain the third event environment variable parameter of the second event to be added to the event group after the target application server creates the event group according to the second environment variable parameter; and a adding unit, which is used to add the second event to the event group according to the third event environment variable parameter.

[0096] Optionally, the above-mentioned device may include: a transfer unit, which is used to add the second event to the event group according to the third event environment variable parameter, and after the subroutine of the target application is started by the main program of the target application, the main program of the target application transfers the third event environment variable parameter of the second event to the subroutine of the target application.

[0097] According to another aspect of the embodiment of the present invention, an electronic device for implementing the above event communication method is also provided. The electronic device may be Figure 1 The terminal device or server shown in FIG. This embodiment is described by taking the electronic device as a server as an example. Figure 7 As shown, the electronic device includes a memory 702 and a processor 704. The memory 702 stores a computer program, and the processor 704 is configured to execute the steps in any of the above method embodiments through the computer program.

[0098] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.

[0099] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0100] S1, obtaining a first event sent by a main program of a target application in a first event loop, wherein the first event loop is a scope of first event communication and includes the main program of the target application and subroutines of the target application;

[0101] S2: Send the first event to a subroutine of a target application in the first event ring according to the type of the first event.

[0102] Alternatively, those skilled in the art will appreciate that Figure 7The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 7 It does not limit the structure of the electronic device. For example, the electronic device may also include Figure 7 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 7 Different configurations shown.

[0103] Among them, the memory 702 can be used to store software programs and modules, such as the program instructions / modules corresponding to the event communication method and device in the embodiment of the present invention. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, that is, realizing the above-mentioned event communication method. The memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 702 may further include a memory remotely located relative to the processor 704, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 702 can be specifically, but not limited to, used for information such as event groups, first events, etc. As an example, if Figure 7 As shown, the memory 702 may include, but is not limited to, the first acquisition unit 61 and the first sending unit 63 in the event communication device. In addition, it may also include, but is not limited to, other module units in the event communication device, which will not be described in detail in this example.

[0104] Optionally, the transmission device 706 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 706 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 706 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0105] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting multiple nodes through network communication. The nodes may form a peer-to-peer (P2P) network, and any computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.

[0106] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the event communication method provided in the above-mentioned event communication aspect or various optional implementations of the event communication aspect. The computer program is configured to perform the steps of any of the above-mentioned method embodiments when it is run.

[0107] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0108] S1, obtaining a first event sent by a main program of a target application in a first event loop, wherein the first event loop is a scope of first event communication and includes the main program of the target application and subroutines of the target application;

[0109] S2: Send the first event to a subroutine of a target application in the first event ring according to the type of the first event.

[0110] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0111] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.

[0112] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing one or more computer devices (such as personal computers, servers, or network devices) to execute all or part of the steps of the methods described in various embodiments of the present invention.

[0113] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0114] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, and can be electrical or other forms.

[0115] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0116] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0117] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. An event communication method, characterized in that: include: Acquire a first event sent by a main program of a target application in a first event loop, wherein the first event loop is a scope of the first event communication and includes the main program of the target application and a subroutine of the target application; sending the first event to a subroutine of the target application in the first event ring according to the type of the first event; Before obtaining the first event sent by the main program of the target application in the first event ring, the method includes: obtaining the second identification information of the second event ring where the main program of the target application is currently located, the second identification information is information identifying that the second event ring is different from the first event ring, and the second event ring is the communication range of the first event; determining the first identification information based on the second identification information, wherein the first identification information is the identification information of the first event ring; and determining the communication range of the first event based on the first identification information.

2. The method according to claim 1, wherein The sending, according to the type of the first event, the first event to the subroutine of the target application in the first event ring includes: In a case where the type of the first event is a directed communication type event, sending the first event to the main program of the target application in a directed manner; or In a case where the type of the first event is a broadcast communication type event, the first event is directed to be sent to the main program of the target application and the subprogram of the target application.

3. The method according to claim 1, characterized in that Before obtaining the first event sent by the main program of the target application in the first event loop, the method further includes: When the target application manager is ready to start the target application, obtaining a first environment variable parameter for running the target application sent by the target application manager; The target application server updates the first environment variable parameter to a second environment variable parameter, wherein the target application server is used to prepare a running environment for the main program of the target application; The target application server creates an event group according to the second environment variable parameter, wherein the event group includes the first event ring.

4. The method according to claim 3, characterized in that The target application server creates an event group according to the second environment variable parameter, including: The target application server calls the target interface to create the event group according to the second environment variable parameter.

5. The method according to claim 3, characterized in that After the target application server creates the event group according to the second environment variable parameter, the method further includes: The first environment variable parameter in the target application manager is updated to the second environment variable parameter.

6. The method according to claim 3, characterized in that After the target application server creates an event group according to the second environment variable parameter, the method further includes: The target application server obtains a third event environment variable parameter of the second event to be added to the event group; The second event is added to the event group according to the third event environment variable parameter.

7. The method according to claim 6, characterized in that After adding the second event to the event group according to the third event environment variable parameter, the method further includes: After the subroutine of the target application is started by the main program of the target application, the main program of the target application passes the third event environment variable parameter of the second event to the subroutine of the target application.

8. An event communication device, characterized in that: include: a first acquiring unit, configured to acquire a first event sent by a main program of a target application in a first event ring, wherein the first event ring is a scope of the first event communication and includes the main program of the target application and a subroutine of the target application; a first sending unit, configured to send the first event to a subroutine of the target application in the first event ring according to a type of the first event; The device includes: a second acquisition unit, used to obtain second identification information of a second event ring where the main program of the target application is currently located before obtaining the first event sent by the main program of the target application in the first event ring, wherein the second identification information is information identifying that the second event ring is different from the first event ring, and the second event ring is the communication range of the first event; a first determination unit, used to determine first identification information based on the second identification information, wherein the first identification information is the identification information of the first event ring; and a second determination unit, used to determine the communication range of the first event based on the first identification information.

9. The device according to claim 8, characterized in that The first sending unit includes: A first sending module is configured to send the first event to the main program of the target application in a targeted manner when the first event is a targeted communication event; or The second sending module is configured to, when the type of the first event is a broadcast communication type event, send the first event to the main program of the target application and the subprogram of the target application in a targeted manner.

10. The device according to claim 9, characterized in that The device further comprises: a third acquiring unit, configured to acquire, before acquiring the first event sent by the main program of the target application in the first event loop, a first environment variable parameter for running the target application sent by the target application manager when the target application manager is preparing to start the target application; A first updating unit is configured to update the first environment variable parameter to a second environment variable parameter at a target application server, wherein the target application server is configured to prepare a running environment for a main program of the target application; A creating unit is configured to create an event group at the target application server according to the second environment variable parameter, wherein the event group includes the first event ring.

11. The device according to claim 10, characterized in that The creation unit includes: A creation module is used for the target application server to call a target interface to create the event group according to the second environment variable parameter.

12. The device according to claim 10, characterized in that The device further comprises: The second updating unit is configured to update the first environment variable parameter in the target application manager to the second environment variable parameter after the target application server creates the event group according to the second environment variable parameter.

13. The device according to claim 10, characterized in that The device further comprises: A fourth acquiring unit is configured to, after the target application server creates an event group according to the second environment variable parameter, enable the target application server to acquire a third event environment variable parameter of a second event to be added to the event group; The adding unit is configured to add the second event to the event group according to the third event environment variable parameter.

14. The device according to claim 13, characterized in that The device further comprises: A transfer unit is used to add the second event to the event group according to the third event environment variable parameter, and after the subroutine of the target application is started by the main program of the target application, the main program of the target application transfers the third event environment variable parameter of the second event to the subroutine of the target application.

15. A computer-readable storage medium comprising a stored program, wherein: When the program is executed, the method described in any one of claims 1 to 7 is executed.

16. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.