CN111061572A - Page communication method, system, equipment and readable storage medium - Google Patents

Page communication method, system, equipment and readable storage medium Download PDF

Info

Publication number
CN111061572A
CN111061572A CN201911121585.1A CN201911121585A CN111061572A CN 111061572 A CN111061572 A CN 111061572A CN 201911121585 A CN201911121585 A CN 201911121585A CN 111061572 A CN111061572 A CN 111061572A
Authority
CN
China
Prior art keywords
page
listener
target message
message
broadcasting device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201911121585.1A
Other languages
Chinese (zh)
Inventor
白子玉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Inspur Data Technology Co Ltd
Original Assignee
Beijing Inspur Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Inspur Data Technology Co Ltd filed Critical Beijing Inspur Data Technology Co Ltd
Priority to CN201911121585.1A priority Critical patent/CN111061572A/en
Publication of CN111061572A publication Critical patent/CN111061572A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Telephone Function (AREA)

Abstract

The application discloses a page communication method, a page communication system, page communication equipment and a readable storage medium. The method disclosed by the application is applied to the mobile phone client and comprises the following steps: if a first listener in the first page monitors a target message generated by the first page, sending the target message to a broadcasting device; the broadcasting device forwards the target message to a second listener in the second page, so that the second page obtains the target message through the second listener; the first page and the second page are different browser pages. The method and the device for monitoring the browser pages are characterized in that the monitors are respectively arranged on different browser pages and are controlled by the same broadcasting device. If a certain monitor monitors the message in the browser page, the message is sent to a broadcasting device for broadcasting, and the monitors in other browser pages can obtain the message, so that communication of different browser pages is realized. The page communication system, the page communication device and the readable storage medium have the technical effects.

Description

Page communication method, system, equipment and readable storage medium
Technical Field
The present application relates to the field of computer communications technologies, and in particular, to a page communication method, system, device, and readable storage medium.
Background
At present, in mobile phone application, different pages in the same browser can communicate with each other, but the pages in different browsers are in an isolated state and cannot communicate, so that the mobile phone application cannot be flexibly expanded. Therefore, how to enable the page to communicate across the browser is a problem to be solved by those skilled in the art.
Disclosure of Invention
In view of the above, an object of the present application is to provide a page communication method, system, device and readable storage medium, so as to implement page cross-browser communication. The specific scheme is as follows:
in a first aspect, the present application provides a page communication method, applied to a mobile phone client, including:
if a first listener in a first page monitors a target message generated by the first page, the first listener sends the target message to a broadcasting device;
the broadcasting device forwards the target message to a second listener in a second page, so that the second page obtains the target message through the second listener, and communication between the first page and the second page is realized;
wherein the first page and the second page are different browser pages.
Preferably, before forwarding the target message to the second listener in the second page, the broadcasting apparatus further includes:
the broadcaster queries the registered listener and determines the queried registered listener as the second listener.
Preferably, the broadcasting device forwards the target message to a second listener in a second page, including:
and if the number of the second listeners is multiple, the broadcasting device forwards the target message to the multiple second listeners.
Preferably, after the second page obtains the target message through the second listener, the method further includes:
the second page analyzes the target message to obtain message content;
and generating a response message according to the message content, and returning the response message.
Preferably, the browser page is a browser container page.
In a second aspect, the present application provides a page communication method, applied to a mobile phone client, including:
if a first listener in a first page monitors a target message generated by the first page, the first listener sends the target message to a broadcasting device;
the broadcasting device forwards the target message to a second listener in a second page, so that the second page obtains the target message through the second listener, and communication between the first page and the second page is realized;
the first page is a browser page, and the second page is a native page.
In a third aspect, the present application provides a page communication system applied to a mobile phone client, including:
the first monitor is used for monitoring a target message generated by a first page, and if the target message is monitored, the target message is sent to a broadcasting device;
the broadcasting device is used for forwarding the target message to a second listener in a second page;
the second listener is configured to transmit the target message to the second page, so that the second page obtains the target message, and communication between the first page and the second page is achieved;
wherein the first page and the second page are different browser pages.
Preferably, the broadcasting device is specifically configured to:
and querying the registered listener, and determining the queried registered listener as the second listener.
Preferably, the method further comprises the following steps:
and the third listener is used for monitoring the message generated by the native page, and if the message is monitored, the message is sent to a broadcasting device, so that the broadcasting device forwards the broadcasting device to the first listener and the second listener.
In a fourth aspect, the present application provides a page communication device, including:
a memory for storing a computer program;
a processor for executing the computer program to implement the page communication method disclosed in the foregoing.
In a fifth aspect, the present application provides a readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the page communication method disclosed above.
According to the scheme, the page communication method is applied to the mobile phone client and comprises the following steps: if a first listener in a first page monitors a target message generated by the first page, the first listener sends the target message to a broadcasting device; the broadcasting device forwards the target message to a second listener in a second page, so that the second page obtains the target message through the second listener, and communication between the first page and the second page is realized; wherein the first page and the second page are different browser pages.
Therefore, the listeners are respectively arranged in different browser pages of the mobile phone client, so that the listeners can listen to the messages of the browser pages, and meanwhile, the listeners are controlled by the same broadcasting device. If a certain listener monitors the message in the browser page, the message can be sent to the broadcasting device, and then the broadcasting device can forward the message to the listeners in other browser pages, so that communication of different browser pages is achieved, namely page communication of cross-browsers is achieved, and flexibility and expandability of mobile phone application development are improved.
Accordingly, the page communication system, the page communication device and the readable storage medium provided by the application also have the technical effects.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flowchart of a first page communication method disclosed in the present application;
FIG. 2 is a schematic flow chart illustrating an implementation of cross-page communication as disclosed herein;
FIG. 3 is a schematic diagram of a page communication system disclosed herein;
FIG. 4 is a schematic view of another page communication system disclosed herein;
fig. 5 is a schematic diagram of a page communication device disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, different pages in the same browser in the mobile phone application can communicate with each other, but the pages in different browsers are in an isolated state and cannot communicate, so that the mobile phone application cannot be flexibly expanded. Therefore, the page communication scheme is provided, page cross-browser communication can be achieved, and flexibility and expandability of mobile phone application development are improved.
Referring to fig. 1, an embodiment of the present application discloses a page communication method, which is applied to a mobile phone client, and includes:
s101, a first listener in a first page monitors a target message generated by the first page;
s102, the first listener sends the target message to a broadcasting device;
in a specific embodiment, before forwarding the target message to the second listener in the second page, the broadcasting apparatus further includes: the broadcaster queries the registered listener and determines the queried registered listener as the second listener.
In one embodiment, the broadcasting device forwards the target message to a second listener in a second page, including: if the number of the second listeners is multiple, the broadcasting device forwards the target message to the multiple second listeners.
S103, the broadcasting device forwards the target message to a second listener in a second page;
s104, the second page obtains the target message through the second listener to realize the communication between the first page and the second page.
It should be noted that the first page and the second page are different browser pages. For example: the first page is a page in browser a and the second page is a page in browser B.
In a specific embodiment, after the second page obtains the target message through the second listener, the method further includes: the second page analyzes the target message to obtain the message content; and generating a response message according to the message content, and returning the response message. The target message may be a message generated when the user operates in the first page, or may be a message automatically generated in the first page.
In this embodiment, the browser page is a browser container page. The embodiment is applied to the mobile phone client, and the mobile phone client is developed based on the container technology. The pages of each browser in the handset client are therefore referred to as browser container pages.
Therefore, the embodiment of the application is provided with the listeners in different browser pages respectively, so that the listeners can listen to the messages of the browser pages and are controlled by the same broadcasting device. If a certain monitor monitors the message in the browser page, the message can be sent to the broadcasting device, and then the broadcasting device can forward the message to monitors in other browser pages, so that communication of different browser pages is realized, and the flexibility and the expandability of mobile phone application development are improved.
In a specific embodiment, a page communication method applied to a mobile phone client includes: if a first listener in a first page monitors a target message generated by the first page, the first listener sends the target message to a broadcasting device; the broadcasting device forwards the target message to a second listener in a second page, so that the second page obtains the target message through the second listener, and communication between the first page and the second page is realized; the first page is a browser page, and the second page is a native page.
The first page and the second page can also be native pages of the mobile phone application, so that communication between different native pages can be realized. Of course, the first page may be a browser page, the second page may be a native page, and both the browser page and the native page are pages in the mobile phone client, so that communication between the browser page and the native page in the mobile phone client is realized.
The following page communication scheme can be realized according to the method provided by the application.
The method comprises the steps of respectively arranging the listeners in different browser pages in a mobile phone client, and simultaneously enabling the listeners to be controlled by the same broadcasting device. When one browser page needs to communicate with another browser page, a listener is registered with a broadcasting device, when a message is published in the page, the listener in the page can monitor the message and can send the message to the broadcasting device, and then the broadcasting device broadcasts the message to all registered listeners, so that the cross-browser page communication is realized.
For example: the browser page A and the browser page B which need to communicate are both provided with a monitor, and both monitors are registered in the broadcasting device. A user opens a browser page B, after the browser page B performs some operations, the browser page B needs to send some messages to a browser page A, and then a listener B in the browser page B sends the messages to a broadcasting device; the broadcasting device broadcasts the message to all registered listeners; so that browser page a can receive the message through listener a.
Referring to fig. 2, the implementation steps of this embodiment include: creating a monitor broadcasting device (namely a broadcasting device), wherein the monitor broadcasting device is used for storing the registered monitors and broadcasting messages to the monitors; creating a browser container (i.e., a browser developed using container technology) for loading page a; a browser container is created, which is used to load page B. The page a and the page B are each provided with a listener registered in the listener broadcasting apparatus.
Therefore, the embodiment of the invention develops the mobile phone application by using the browser container, provides a low-cost cross-page communication method, realizes the decoupling of message receiving and sending, and can keep the original browser container development framework unchanged. According to the embodiment, when the mobile phone client is developed, under the condition that a plurality of browser instances exist in the mobile phone client (one browser can be regarded as one browser instance), communication across the browser instances can be realized. The mobile phone client can be developed by directly using a traditional web development method, and the browser page can be multiplexed between the iOS system and the Android system. And the native page can communicate with the browser page, so that data transmission between the pages is more convenient.
In the following, a page communication system provided by the embodiment of the present application is introduced, and a page communication system described below and a page communication method described above may be referred to each other.
Referring to fig. 3, an embodiment of the present application discloses a page communication system, which is applied to a mobile phone client, and includes:
the first listener 301 is configured to monitor a target message generated by the first page, and if the target message is monitored, send the target message to the broadcasting device;
a broadcasting device 302, configured to forward the target message to a second listener in a second page;
the second listener 303 is configured to transmit the target message to the second page, so that the second page obtains the target message, and communication between the first page and the second page is achieved;
the first page and the second page are different browser pages.
In one embodiment, the broadcasting device is specifically configured to:
the registered listener is queried and the queried registered listener is determined to be the second listener.
In a specific embodiment, the method further comprises the following steps:
and the third listener is used for monitoring the message generated by the original page, and if the message is monitored, the message is sent to the broadcasting device, so that the broadcasting device forwards the broadcasting device to the first listener and the second listener.
In one embodiment, the broadcasting device is specifically configured to:
and forwarding the target message to a third listener to realize the communication between the browser page and the native page.
Referring to fig. 4, an embodiment of the present application discloses another page communication system, including: a broadcaster and a plurality of listeners, wherein: a plurality of listeners are listener N, which is a positive integer, such as listener 1 and listener 2 … … in fig. 4.
The broadcast device is used for receiving and broadcasting the messages sent by each listener;
the monitor is used for monitoring the message in the self page and receiving the message broadcast by the broadcasting device.
For more specific working processes of each module and unit in this embodiment, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not described here again.
Therefore, the embodiment provides a page communication system, which realizes communication of different browser pages and improves flexibility and expandability of mobile phone application development.
In the following, a page communication device provided in an embodiment of the present application is introduced, and a page communication device described below and a page communication method and apparatus described above may be referred to each other.
Referring to fig. 5, an embodiment of the present application discloses a page communication device, including:
a memory 501 for storing a computer program;
a processor 502 for executing the computer program to implement the method disclosed in any of the embodiments above.
A readable storage medium provided in the embodiments of the present application is introduced below, and a readable storage medium described below and a page communication method, a page communication system, and a page communication apparatus described above may be referred to each other.
A readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the page communication method disclosed in the foregoing embodiments. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
References in this application to "first," "second," "third," "fourth," etc., if any, are intended to distinguish between similar elements and not necessarily to describe a particular order or sequence. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, or apparatus.
It should be noted that the descriptions in this application referring to "first", "second", etc. are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of readable storage medium known in the art.
The principle and the implementation of the present application are explained herein by applying specific examples, and the above description of the embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A page communication method is applied to a mobile phone client, and comprises the following steps:
if a first listener in a first page monitors a target message generated by the first page, the first listener sends the target message to a broadcasting device;
the broadcasting device forwards the target message to a second listener in a second page, so that the second page obtains the target message through the second listener, and communication between the first page and the second page is realized;
wherein the first page and the second page are different browser pages.
2. The page communication method according to claim 1, wherein the broadcasting device forwards the target message to a second listener in a second page, further comprising:
the broadcaster queries the registered listener and determines the queried registered listener as the second listener.
3. The page communication method according to claim 2, wherein said broadcasting means forwards said target message to a second listener in a second page, comprising:
and if the number of the second listeners is multiple, the broadcasting device forwards the target message to the multiple second listeners.
4. The page communication method according to claim 1, wherein after the second page obtains the target message through the second listener, the method further comprises:
the second page analyzes the target message to obtain message content;
and generating a response message according to the message content, and returning the response message.
5. Page communication method according to any of claims 1 to 4, characterized in that the browser page is a browser container page.
6. A page communication system is applied to a mobile phone client and comprises the following components:
the first monitor is used for monitoring a target message generated by a first page, and if the target message is monitored, the target message is sent to a broadcasting device;
the broadcasting device is used for forwarding the target message to a second listener in a second page;
the second listener is configured to transmit the target message to the second page, so that the second page obtains the target message, and communication between the first page and the second page is achieved;
wherein the first page and the second page are different browser pages.
7. The page communication system according to claim 6, wherein said broadcasting means is specifically configured to:
and querying the registered listener, and determining the queried registered listener as the second listener.
8. Page communication system according to claim 6 or 7, characterized in that it further comprises:
and the third listener is used for monitoring the message generated by the native page, and if the message is monitored, the message is sent to a broadcasting device, so that the broadcasting device forwards the broadcasting device to the first listener and the second listener.
9. A page communication device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the page communication method of any of claims 1 to 5.
10. A readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the page communication method according to any one of claims 1 to 5.
CN201911121585.1A 2019-11-15 2019-11-15 Page communication method, system, equipment and readable storage medium Withdrawn CN111061572A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911121585.1A CN111061572A (en) 2019-11-15 2019-11-15 Page communication method, system, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911121585.1A CN111061572A (en) 2019-11-15 2019-11-15 Page communication method, system, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN111061572A true CN111061572A (en) 2020-04-24

Family

ID=70298490

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911121585.1A Withdrawn CN111061572A (en) 2019-11-15 2019-11-15 Page communication method, system, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111061572A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500535A (en) * 2022-01-21 2022-05-13 北京百度网讯科技有限公司 Message processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060026233A1 (en) * 2002-06-17 2006-02-02 Tenembaum Samuel S Enabling communication between users surfing the same web page
CN103095762A (en) * 2011-11-02 2013-05-08 腾讯科技(深圳)有限公司 Web page cross-domain communication method and device
CN107562454A (en) * 2017-08-14 2018-01-09 国云科技股份有限公司 The real-time webpage sychronisation of browser-cross and implementation method
CN109002366A (en) * 2018-07-26 2018-12-14 广东蔚海数问大数据科技有限公司 A kind of remote debugging method and device of mobile terminal webpage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060026233A1 (en) * 2002-06-17 2006-02-02 Tenembaum Samuel S Enabling communication between users surfing the same web page
CN103095762A (en) * 2011-11-02 2013-05-08 腾讯科技(深圳)有限公司 Web page cross-domain communication method and device
CN107562454A (en) * 2017-08-14 2018-01-09 国云科技股份有限公司 The real-time webpage sychronisation of browser-cross and implementation method
CN109002366A (en) * 2018-07-26 2018-12-14 广东蔚海数问大数据科技有限公司 A kind of remote debugging method and device of mobile terminal webpage

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500535A (en) * 2022-01-21 2022-05-13 北京百度网讯科技有限公司 Message processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
JP2019537356A (en) Method of updating location area of user terminal, access network entity, user terminal and core network entity
CN106921754B (en) Load balancing method, device, medium and electronic equipment of cluster system
CN108737500B (en) Target resource obtaining and providing method and device, storage medium and computer equipment
CN104301443A (en) Method and system for calling end capacity ports on web page
CN103916373A (en) Data updating method, server, client side and system
CN109302437B (en) Method and device for redirecting website
CN101183946B (en) Method and system of obtaining resource listing of download file
CN109982152B (en) P2P CDN service processing method, intelligent gateway and CDN platform
CN105704155A (en) Information push method and device
CN102098330A (en) Method, device and system for asynchronous transmission based on json data format
CN104243266A (en) Method and device for network access
CN105490917A (en) Sharing method and device in application
CN104469394A (en) Video resource acquiring method, background server, video client and system
CN103024098B (en) A kind of domain name analytic method, system and device
CN109561167A (en) A kind of domain name analytic method and device
CN104283920A (en) Use method, server, terminal and system for Webapp router
CN111061572A (en) Page communication method, system, equipment and readable storage medium
US20170111480A1 (en) Page insertion method and device
CN113542420A (en) Hotspot file processing method and device, electronic equipment and medium
CN103051722B (en) A kind ofly determine the method whether page is held as a hostage and relevant device
US11071151B2 (en) Methods and apparatuses for connecting a wireless access point through an application in a user equipment
CN111131323A (en) Message transmission method and related device
CN103678332A (en) System, browser and method for displaying page
CN109600452B (en) Server cluster, message pushing method and related server
CN105100151A (en) Content distribution method, apparatus and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20200424