Message transmission method, device and equipment and computer readable storage medium
By receiving encrypted broadcast messages and monitoring subscriber status, and sending notifications to active subscribers to retrieve and decrypt messages, the problems of resource waste and memory leaks in the Android system are solved, achieving efficient and secure message delivery.
Patent Information
- Application Number
- CN202310008030.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-04
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2043-01-04
AI Technical Summary
In existing technologies, broadcasting in the Android system cannot effectively avoid resource waste and memory leaks, and the information transmission efficiency and security are relatively low.
By receiving encrypted broadcast messages, monitoring the status of message subscribers, and sending notification messages to active subscribers, subscribers can obtain and decrypt encrypted broadcast messages based on identification information and delete the transmitted messages, thus achieving encrypted and automatic clearing of message transmission.
It improves the efficiency and security of information transmission, avoids resource waste and memory leaks, and ensures the stability of message transmission.
Smart Images

Figure CN116015956B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and in particular relates to a message passing method, apparatus, device and computer-readable storage medium. Background Technology
[0002] In existing technologies, broadcasts in the Android system are divided into standard broadcasts and ordered broadcasts. A standard broadcast is a completely asynchronous broadcast; after the broadcast is sent, all broadcast receivers can receive the broadcast message simultaneously and then perform their respective logical processing. An ordered broadcast is a synchronous broadcast; after the broadcast is sent, only one highest-priority broadcast receiver can receive it at a time. However, standard broadcasts cannot be truncated, meaning all broadcast receivers can receive the broadcast, leading to resource waste; while ordered broadcasts can only be received by one broadcast receiver at a time, resulting in lower information transmission efficiency.
[0003] Furthermore, to enable broadcast reception, users need to manually register the broadcast receiver, and after receiving a broadcast, they also need to manually unregister the broadcast receiver; otherwise, it will lead to memory leaks. Moreover, the stability and security of information transmission in existing technologies are relatively low. Summary of the Invention
[0004] This application provides a message passing method, apparatus, device, computer-readable storage medium, and computer program product that can avoid resource waste and memory leaks, and improve the efficiency, stability, and security of information passing.
[0005] In a first aspect, embodiments of this application provide a message passing method, the method comprising:
[0006] Receive a first encrypted broadcast message sent to the first message channel by the first message publisher, wherein the first encrypted broadcast message is a message obtained by the first message publisher encrypting the first broadcast message;
[0007] Identify at least one message subscriber corresponding to the first message publisher;
[0008] Monitor the status of at least one message subscriber;
[0009] When the target message subscriber is in an active state, a first notification message is sent to the target message subscriber. The first notification message includes identification information corresponding to the first message channel. The first notification message is used to instruct the target message subscriber to determine the first message channel according to the identification information, and to obtain and decrypt the first encrypted broadcast message from the first message channel to obtain the first broadcast message. The target message subscriber is any one of the message subscribers.
[0010] In a case where all the message subscribers in the at least one message subscriber in an active state acquire the first broadcast message, the first encrypted broadcast message is deleted.
[0011] In a possible implementation, the method further includes:
[0012] In a case where the first encrypted broadcast message is not deleted and the first message publisher publishes a second broadcast message, a second encrypted broadcast message sent by the first message publisher to a second message channel is received, where the second encrypted broadcast message is a message obtained by the first message publisher encrypting the second broadcast message.
[0013] In a possible implementation, the receiving the first encrypted broadcast message sent by the first message publisher to the first message channel includes:
[0014] Receiving encrypted broadcast messages sent by a plurality of message publishers to a plurality of message channels respectively, where the plurality of message publishers include the first message publisher, and the plurality of message channels include the first message channel.
[0015] In a possible implementation, the method further includes:
[0016] In a case where the life cycle of the target message subscriber ends, the correspondence between the target message subscriber and the first message publisher is removed.
[0017] In a possible implementation, before determining the at least one message subscriber corresponding to the first message publisher, the method further includes:
[0018] Receiving first input of a user for binding the first message publisher and the at least one message subscriber;
[0019] In response to the first input, the first message publisher and the at least one message subscriber are bound, to obtain the correspondence between the first message publisher and the at least one message subscriber.
[0020] In a possible implementation, before sending the first notification message to the target message subscriber, the method further includes:
[0021] Obtaining a plurality of message channels;
[0022] Setting a plurality of identification information corresponding to the plurality of message channels respectively.
[0023] In a second aspect, an embodiment of the present application provides a message transmission device, which includes:
[0024] a first receiving module, configured to receive a first encrypted broadcast message sent by a first message publisher to a first message channel, wherein the first encrypted broadcast message is a message obtained by the first message publisher encrypting a first broadcast message;
[0025] a determining module, configured to determine at least one message subscriber corresponding to the first message publisher;
[0026] a monitoring module, configured to monitor a state of the at least one message subscriber;
[0027] a sending module, configured to send a first notification message to a target message subscriber in a case where the state of the target message subscriber is an active state, the first notification message including identification information corresponding to the first message channel, the first notification message being used to instruct the target message subscriber to determine the first message channel according to the identification information, and to acquire and decrypt the first encrypted broadcast message from the first message channel to obtain the first broadcast message, wherein the target message subscriber is any one of the message subscribers;
[0028] a deleting module, configured to delete the first encrypted broadcast message in a case where all message subscribers in the active state among the at least one message subscriber acquire the first broadcast message.
[0029] In a third aspect, an electronic device is provided, and the electronic device includes a processor and a memory storing computer program instructions.
[0030] The processor, when executing the computer program instructions, implements the method in any possible implementation method of the first aspect.
[0031] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores computer program instructions. The computer program instructions, when executed by a processor, implement the method in any possible implementation method of the first aspect.
[0032] In a fifth aspect, a computer program product is provided. Instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the method in any possible implementation method of the first aspect.
[0033] The message transmission method, device, equipment, computer readable storage medium and computer program product provided by the embodiments of the present application can send a first notification message to a target message subscriber in an active state, so that only the target message subscriber can obtain the first broadcast message, thereby avoiding resource waste. The target message subscriber determines a first message channel according to the identification information in the first notification message, and obtains and decrypts the first encrypted broadcast message from the first message channel to obtain the first broadcast message, so that multiple target message subscribers can obtain the first broadcast message at the same time, thereby improving the efficiency of message transmission. In the case that the first encrypted broadcast message is deleted when at least one message subscriber in an active state obtains the first broadcast message, the first encrypted broadcast message can be automatically deleted, thereby avoiding memory leakage. By encrypting the first broadcast message, the stability and security of message transmission can be ensured. In this way, by the embodiments of the present application, resource waste and memory leakage can be avoided, and the efficiency, stability and security of information transmission can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments of the present application will be briefly introduced. Those skilled in the art can obtain other drawings according to these drawings without creating any creative labor.
[0035] Figure 1 is a flow diagram of a message transmission method provided by the embodiments of the present application;
[0036] Figure 2 is a schematic diagram of message transmission provided by the embodiments of the present application;
[0037] Figure 3 is a structural schematic diagram of a message transmission device provided by the embodiments of the present application;
[0038] Figure 4 is a structural schematic diagram of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0039] The features and exemplary embodiments of various aspects of the present application will be described in detail below, in order to make the purposes, technical solutions and advantages of the present application more clear and apparent, the present application will be further described in detail below in combination with the drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, but not to limit the present application. The present application can be implemented without some of these specific details by those skilled in the art. The following description of the embodiments is only to provide a better understanding of the present application by showing examples of the present application.
[0040] It should be noted that, in this document, the terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between such entities or operations. Moreover, the terms "comprising", "containing", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements recited, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, the elements defined by the statement "comprising" do not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the elements recited.
[0041] In addition, the acquisition, storage, use, processing, etc. of data in the technical solutions of the present application comply with the relevant provisions of national laws and regulations.
[0042] As described in the background section, in order to solve the problems of the prior art, the present application provides a message passing method, device, equipment, computer readable storage medium and computer program product.
[0043] First, the message passing method provided by the present application will be introduced.
[0044] Figure 1 A flowchart of a message passing method provided by the present application is shown. As shown in Figure 1 The message passing method provided by the present application includes the following steps:
[0045] S110, receiving a first encrypted broadcast message sent by a first message publisher to a first message channel, wherein the first encrypted broadcast message is a message obtained by encrypting a first broadcast message by the first message publisher;
[0046] S120, determining at least one message subscriber corresponding to the first message publisher;
[0047] S130, monitoring the state of the at least one message subscriber;
[0048] S140, in the case that the state of a target message subscriber is an active state, sending a first notification message to the target message subscriber, the first notification message including identification information corresponding to the first message channel, the first notification message being used to instruct the target message subscriber to determine the first message channel according to the identification information, and to obtain and decrypt the first encrypted broadcast message from the first message channel to obtain the first broadcast message, wherein the target message subscriber is any one of the message subscribers;
[0049] S150, in the case that the message subscribers in the at least one message subscriber in the active state all acquire the first broadcast message, deleting the first encrypted broadcast message.
[0050] The message transmission method of the embodiments of the present application can send the first notification message to the target message subscriber in the active state, so that only the target message subscriber can acquire the first broadcast message, avoiding resource waste. By determining the first message channel according to the identification information in the first notification message, and acquiring and decrypting the first encrypted broadcast message from the first message channel to obtain the first broadcast message, the plurality of target message subscribers can simultaneously acquire the first broadcast message, thereby improving the efficiency of message transmission. By deleting the first encrypted broadcast message in the case that the message subscribers in the at least one message subscriber in the active state all acquire the first broadcast message, the first encrypted broadcast message can be automatically deleted, avoiding memory leakage. By encrypting the first broadcast message, the stability and security of message transmission can be ensured. In this way, by the embodiments of the present application, resource waste and memory leakage can be avoided, and the efficiency, stability and security of information transmission can be improved.
[0051] The specific implementation of each of the above steps will be described below.
[0052] In some embodiments, in S110, the first message channel can be any one of a plurality of message channels. The message channel can be a LiveData message channel. By using LiveData as a message channel, the message bus function can be realized. In addition, the first broadcast message can be any Object, or any type of message. The message type of the first broadcast message can be, for example, Boolean, String, Double, Float, Int, Long, etc., and can also be a custom type.
[0053] As an example, after the first message publisher generates the first broadcast message, the first broadcast message can be encrypted to obtain the first encrypted broadcast message. The encryption method can be, for example, MD5 encryption. After obtaining the first encrypted broadcast message, the first message publisher can first acquire the first message channel by getChannel, and then call setValue or postValue to send the first encrypted broadcast message to the first message channel.
[0054] Therefore, in order to make full use of existing resources, flexibly transmit messages and improve the efficiency of message transmission, in some embodiments, S110 can specifically include:
[0055] receive encrypted broadcast messages sent by a plurality of message publishers to a plurality of message channels respectively, wherein the plurality of message publishers comprises a first message publisher, and the plurality of message channels comprises a first message channel.
[0056] Here, the plurality of message publishers can publish broadcast messages simultaneously or respectively, and the time and order of publishing the broadcast messages are not limited. The message publisher does not have to send the message to a specific message channel.
[0057] As an example, after the first message publisher sends the first encrypted broadcast message to the first message channel, the first message channel can temporarily store the first encrypted broadcast message. At this time, if the second message publisher generates a second broadcast message, the second encrypted broadcast message can be sent to the second message channel. If the first encrypted broadcast message in the first message channel has been deleted, in the case that the second message publisher generates the second broadcast message, the first encrypted broadcast message can be sent to the second message channel.
[0058] In this way, by receiving encrypted broadcast messages sent by a plurality of message publishers to a plurality of message channels respectively, the existing resources can be fully utilized, the message can be delivered flexibly, and the efficiency of message delivery can be improved.
[0059] In some embodiments, in S120, the first message publisher can have a corresponding relationship with at least one message subscriber. That is, the message published by the first message publisher can be subscribed by the at least one message subscriber.
[0060] Based on this, in order to determine the at least one message subscriber corresponding to the first message publisher, in some embodiments, before S120, the method can further comprise:
[0061] receiving a first input of a user for binding the first message publisher and the at least one message subscriber;
[0062] in response to the first input, binding the first message publisher and the at least one message subscriber to obtain a corresponding relationship between the first message publisher and the at least one message subscriber.
[0063] Here, the at least one message subscriber corresponding to the first message publisher can exist in the form of a subscriber list.
[0064] In this way, according to the corresponding relationship between the first message publisher and the at least one message subscriber, the at least one message subscriber corresponding to the first message publisher can be determined.
[0065] In some embodiments, in S130, the state of the message subscriber can include an active state and a lifecycle end state. Wherein the message subscriber can be an Observer, the active state can be an Active state, and the lifecycle end state can be Destroyed.
[0066] In some embodiments, in S140, the target message subscriber can be any one of the message subscribers.
[0067] As an example, by reading the subscriber message list, each message subscriber in the subscriber message list can be taken as a target message subscriber in turn.
[0068] In addition, the state of the target message subscriber can be an active state or a lifecycle end state. In the case where the state of the target message subscriber is an active state, a first notification message including the identification information corresponding to the first message channel can be sent to the target message subscriber in the active state, to notify the target message subscriber in the active state that the first broadcast message can be obtained.
[0069] As an example, after receiving the first notification message, the target message subscriber can determine the first message channel according to the identification information in the first notification message. After determining the first message channel, the target message subscriber can first obtain the first message channel through getChannel, and then call observe to obtain the first encrypted broadcast message in the first message channel. After obtaining the first encrypted broadcast message, the target message subscriber can decrypt the first encrypted broadcast message to obtain the first broadcast message.
[0070] Based on this, in order to avoid memory leakage, in some embodiments, the following can also be included:
[0071] In the case where the lifecycle of the target message subscriber ends, the correspondence between the target message subscriber and the first message publisher is released.
[0072] Here, the process of releasing the correspondence between the target message subscriber and the first message publisher can be the process of unsubscribing.
[0073] In this way, by releasing the correspondence between the target message subscriber and the first message publisher (unsubscribing), the number of message subscribers in the subscriber list can be reduced, thereby avoiding memory leakage.
[0074] Based on this, in order to enable the message subscriber to determine the message channel, in some embodiments, before the above S140, the following can also be included:
[0075] Obtain a plurality of message channels;
[0076] A plurality of message channels are set respectively corresponding to a plurality of identification information.
[0077] Here, different message channels can correspond to different identification information. Specifically, the identification information can be a specific value. The type of the specific value can be Int. In addition, the identification information can also be a specific name. The type of the name can be String.
[0078] In this way, the corresponding LiveData message channel can be determined through the identification information, so that the message subscriber can determine the message channel according to the identification information.
[0079] In some embodiments, in S150, if the above message subscriber has obtained the first broadcast message, the first encrypted broadcast message can be automatically deleted from the first message channel, avoiding memory leakage.
[0080] Based on this, in order to improve the efficiency of message transmission, in some embodiments, the following can also be included:
[0081] In the case where the first encrypted broadcast message is not deleted and the first message publisher generates a second broadcast message, the second encrypted broadcast message sent by the first message publisher to the second message channel is received, wherein the second encrypted broadcast message is the message obtained by the first message publisher encrypting the second broadcast message.
[0082] Here, since the first encrypted broadcast message is still in the first message channel, in the case where the first message publisher generates a second broadcast message, the second message channel can be obtained, and the second broadcast message can be sent to the second message channel.
[0083] In this way, since the message bus can include a plurality of message channels, each encrypted broadcast message can be provided with a message channel. In this way, by receiving the encrypted broadcast messages sent to different message channels, the efficiency of message transmission can be improved.
[0084] In order to better describe the whole scheme, based on the above embodiments, some specific examples are given.
[0085] For example, as Figure 2As shown, there can be multiple LiveDatas in the message bus, and each LiveData can be a message channel. Each LiveData message channel can have unique identification information. The message publisher can first obtain the message channel through getChannel, and then call setValue or postValue to publish the message. After receiving the message published by the message publisher, the message subscriber can be notified to subscribe to the message. The message subscriber can first obtain the message channel through getChannel according to the identification information, and then call observe to subscribe to the message of this message channel. The relationship between the message publisher and the message subscriber can be many-to-many.
[0086] Based on the message passing method provided in the above embodiments, the application also provides a specific implementation of a message passing device. Please refer to the following embodiments.
[0087] As shown in the following embodiments, the message passing device 300 provided by the embodiments of the application includes the following modules: Figure 3
[0088] The first receiving module 310 is configured to receive a first encrypted broadcast message sent by a first message publisher to a first message channel, wherein the first encrypted broadcast message is a message obtained by encrypting a first broadcast message by the first message publisher.
[0089] The determining module 320 is configured to determine at least one message subscriber corresponding to the first message publisher.
[0090] The monitoring module 330 is configured to monitor the state of the at least one message subscriber.
[0091] The sending module 340 is configured to send a first notification message to a target message subscriber in a case where the state of the target message subscriber is an active state, the first notification message including identification information corresponding to the first message channel, the first notification message being used to instruct the target message subscriber to determine the first message channel according to the identification information, and to obtain and decrypt the first encrypted broadcast message from the first message channel to obtain the first broadcast message, wherein the target message subscriber is any one of the message subscribers.
[0092] The deleting module 350 is configured to delete the first encrypted broadcast message in a case where all the message subscribers in the active state among the at least one message subscriber have obtained the first broadcast message.
[0093] The message passing device 300 is described in detail as follows:
[0094] In some embodiments, the message passing device 300 can further include:
[0095] The second receiving module is configured to receive a second encrypted broadcast message sent by the first message publisher to a second message channel in a case where the first encrypted broadcast message is not deleted and the first message publisher generates a second broadcast message, wherein the second encrypted broadcast message is a message obtained by encrypting the second broadcast message by the first message publisher.
[0096] In some embodiments, the first receiving module 310 can include the following modules:
[0097] The receiving sub-module is configured to receive encrypted broadcast messages sent by a plurality of message publishers to a plurality of message channels respectively, wherein the plurality of message publishers include the first message publisher, and the plurality of message channels include the first message channel.
[0098] In some embodiments, the message delivery apparatus 300 can further include the following modules:
[0099] The releasing module is configured to release the correspondence between the target message subscriber and the first message publisher in a case where the life cycle of the target message subscriber ends.
[0100] In some embodiments, the message delivery apparatus 300 can further include the following modules:
[0101] The third receiving module is configured to receive a first input for binding the first message publisher and at least one message subscriber by a user before determining the at least one message subscriber corresponding to the first message publisher.
[0102] The binding module is configured to bind the first message publisher and the at least one message subscriber to obtain the correspondence between the first message publisher and the at least one message subscriber in response to the first input.
[0103] In some embodiments, the message delivery apparatus 300 can further include the following modules:
[0104] The obtaining module is configured to obtain a plurality of message channels before sending the first notification message to the target message subscriber.
[0105] The setting module is configured to set a plurality of identification information corresponding to the plurality of message channels respectively.
[0106] The message delivery apparatus provided in the embodiments of the present application sends the first notification message to the target message subscriber in the active state, so that only the target message subscriber can obtain the first broadcast message, avoiding resource waste. The target message subscriber determines the first message channel according to the identification information in the first notification message, and obtains and decrypts the first encrypted broadcast message from the first message channel to obtain the first broadcast message, so that multiple target message subscribers can obtain the first broadcast message at the same time, thereby improving the efficiency of message delivery. The first encrypted broadcast message is deleted in the case that the message subscriber in the active state among the at least one message subscriber obtains the first broadcast message, so that the first encrypted broadcast message can be automatically deleted, avoiding memory leakage. The first broadcast message is delivered by encryption, so that the stability and security of message delivery can be ensured. In this way, by the embodiments of the present application, resource waste and memory leakage can be avoided, and the efficiency, stability and security of information delivery can be improved.
[0107] Based on the message delivery method provided in the above embodiments, the present application further provides a specific implementation of an electronic device. Figure 4 A schematic diagram of an electronic device 400 provided by the embodiments of the present application is shown.
[0108] The electronic device 400 can include a processor 410 and a memory 420 storing computer program instructions.
[0109] Specifically, the processor 410 described above can include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or can be configured as one or more integrated circuits that implement the embodiments of the present application.
[0110] The memory 420 can include a mass storage for data or instructions. By way of example and not limitation, the memory 420 can include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 420 can include removable or non-removable (or fixed) media. Where appropriate, the memory 420 can be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, the memory 420 is a non-volatile solid-state memory.
[0111] The memory can include read-only memory (ROM), random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software that, when executed (by one or more processors), is operable to perform operations described with reference to the method according to the first aspect of the present application.
[0112] The processor 410 implements any one of the message passing methods in the above embodiments by reading and executing computer program instructions stored in the memory 420.
[0113] In one example, the electronic device 400 can further include a communication interface 430 and a bus 440. As shown, the processor 410, the memory 420, and the communication interface 430 are connected through the bus 440 and complete communication therebetween. Figure 4
[0114] The communication interface 430 is mainly used to realize the communication between the modules, devices, units, and / or equipment in the embodiments of the present application.
[0115] The bus 440 includes hardware, software, or both, which couples the components of the electronic device to each other. By way of example, and not limitation, the bus can include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association local (VLB) bus, or another suitable bus or combination of two or more of these. Where appropriate, the bus 440 can include one or more buses. Although the present application describes and illustrates a particular bus, the present application contemplates any suitable bus or interconnect.
[0116] By way of example, the electronic device 400 can be a mobile phone, a tablet computer, a notebook computer, a palm computer, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc.
[0117] The electronic device can perform the message passing method in the embodiments of the present application, thereby realizing the message passing method in the embodiments of the present applicationFigures 1 to 3 The described messaging method and apparatus.
[0118] In addition, in combination with the messaging method in the above-mentioned embodiments, the embodiments of the present application can provide a computer storage medium for implementation. The computer storage medium has computer program instructions stored thereon; the computer program instructions are executed by a processor to implement any of the messaging methods in the above-mentioned embodiments.
[0119] It needs to be made clear that the present application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of well-known methods are omitted herein. In the above-mentioned embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order of the steps, after understanding the spirit of the present application.
[0120] The functional blocks shown in the structural block diagrams described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, etc. When implemented in software, the elements of the present application are program or code segments used to perform the required tasks. The program or code segments can be stored in a machine-readable medium or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link. The "machine-readable medium" can include any medium capable of storing or transmitting information. Examples of the machine-readable medium include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segments can be downloaded via a computer network such as the Internet, an intranet, etc.
[0121] It also needs to be made clear that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or apparatuses. However, the present application is not limited to the order of the above-mentioned steps, that is, the steps can be executed in the order mentioned in the embodiments, or in an order different from the embodiments, or several steps can be executed simultaneously.
[0122] The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other processing device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other processing device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0123] The above only is a specific implementation of the present application, and those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, module and unit can refer to the corresponding process in the foregoing method embodiments, which will not be described herein. It should be understood that the protection scope of the present application is not limited to this, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed in the present application, and these modifications or replacements shall be covered within the protection scope of the present application.
Claims
1. A message passing method, characterized by, The method is applied to an electronic device and comprises the following steps: receiving a first encrypted broadcast message sent by a first message publisher to any first message channel of a plurality of message channels, wherein the first encrypted broadcast message is a message obtained by encrypting a first broadcast message by the first message publisher; determining at least one message subscriber corresponding to the first message publisher based on a binding relationship between message publishers and message subscribers; monitoring a state of the at least one message subscriber; in a case where a state of a target message subscriber is an active state, sending a first notification message to the target message subscriber, the first notification message comprising identification information corresponding to the first message channel, the first notification message being used to instruct the target message subscriber to determine the first message channel according to the identification information and to obtain and decrypt the first encrypted broadcast message from the first message channel to obtain the first broadcast message, wherein the target message subscriber is any one of the message subscribers; in a case where all message subscribers in the active state in the at least one message subscriber obtain the first broadcast message, deleting the first encrypted broadcast message in the first message channel; the method further comprises the following steps: after the first message publisher sends the first encrypted broadcast message to the first message channel, the first message channel temporarily stores the first encrypted broadcast message, at this time, if a second message publisher generates a second broadcast message, the second message publisher sends a second encrypted broadcast message to a second message channel; if the first encrypted broadcast message in the first message channel has been deleted, in a case where the second message publisher generates a second broadcast message, the second message publisher sends a second encrypted broadcast message to the first message channel, wherein the second encrypted broadcast message is a message obtained by encrypting the second broadcast message; in a case where the first encrypted broadcast message has not been deleted and the first message publisher generates a second broadcast message, receiving a second encrypted broadcast message sent by the first message publisher to a second message channel.
2. The method of claim 1, wherein, the receiving of the first encrypted broadcast message sent by the first message publisher to the first message channel comprises the following steps: receiving encrypted broadcast messages sent by a plurality of message publishers to a plurality of message channels, wherein the plurality of message publishers comprise the first message publisher, and the plurality of message channels comprise the first message channel.
3. The method of claim 1, wherein, the method further comprises the following steps: in a case where a life cycle of the target message subscriber ends, canceling the correspondence between the target message subscriber and the first message publisher.
4. The method of claim 1, wherein, before the determination of the at least one message subscriber corresponding to the first message publisher, the method further comprises the following steps: receiving a first input of a user for binding the first message publisher and the at least one message subscriber; in response to the first input, binding the first message publisher and the at least one message subscriber to obtain the correspondence between the first message publisher and the at least one message subscriber.
5. The method of claim 1, wherein, Before sending the first notification message to the target message subscriber, the method further comprises: obtaining a plurality of message channels; setting a plurality of identification information corresponding to the plurality of message channels respectively.
6. A messaging device, comprising: The device is applied to an electronic device, and the device comprises: a first receiving module, configured to receive a first encrypted broadcast message sent by a first message publisher to any one of a plurality of message channels, wherein the first encrypted broadcast message is a message obtained by encrypting a first broadcast message by the first message publisher; a determining module, configured to determine at least one message subscriber corresponding to the first message publisher based on a binding relationship between message publishers and message subscribers; a monitoring module, configured to monitor a state of the at least one message subscriber; a sending module, configured to send a first notification message to a target message subscriber in a case where the state of the target message subscriber is an active state, wherein the first notification message comprises identification information corresponding to the first message channel, the first notification message is used to instruct the target message subscriber to determine the first message channel according to the identification information, and to obtain and decrypt the first encrypted broadcast message from the first message channel to obtain the first broadcast message, wherein the target message subscriber is any one of the message subscribers; a deleting module, configured to delete the first encrypted broadcast message in the first message channel in a case where all the message subscribers in the active state in the at least one message subscriber have obtained the first broadcast message; the sending module is further configured to temporarily store the first encrypted broadcast message in the first message channel after the first message publisher sends the first encrypted broadcast message to the first message channel, at this time, if a second message publisher generates a second broadcast message, the second encrypted broadcast message is sent to a second message channel, if the first encrypted broadcast message in the first message channel has been deleted, the second encrypted broadcast message is sent to the first message channel in a case where the second message publisher generates a second broadcast message, wherein the second encrypted broadcast message is a message obtained by encrypting the second broadcast message; the first receiving module is further configured to receive the second encrypted broadcast message sent by the first message publisher to a second message channel in a case where the first encrypted broadcast message has not been deleted and the first message publisher generates a second broadcast message.
7. An electronic device, comprising: The electronic device comprises a processor and a memory storing computer program instructions; The processor executes the computer program instructions to implement the message transmission method of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions, and the computer program instructions are executed by the processor to implement the message transmission method of any one of claims 1-5.
9. A computer program product, characterised in that, The instructions in the computer program product are executed by the processor of the electronic device, so that the electronic device executes the message transmission method of any one of claims 1-5.
Citation Information
Patent Citations
Message transmission method for Android system and computer readable storage medium
CN112416623A