WO2020134754A1 - Page communication method and apparatus, computer device and storage medium - Google Patents

Page communication method and apparatus, computer device and storage medium Download PDF

Info

Publication number
WO2020134754A1
WO2020134754A1 PCT/CN2019/120032 CN2019120032W WO2020134754A1 WO 2020134754 A1 WO2020134754 A1 WO 2020134754A1 CN 2019120032 W CN2019120032 W CN 2019120032W WO 2020134754 A1 WO2020134754 A1 WO 2020134754A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
communication
client
state
server
Prior art date
Application number
PCT/CN2019/120032
Other languages
French (fr)
Chinese (zh)
Inventor
饶建兵
Original Assignee
广州市百果园信息技术有限公司
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 广州市百果园信息技术有限公司 filed Critical 广州市百果园信息技术有限公司
Publication of WO2020134754A1 publication Critical patent/WO2020134754A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/142Managing session states for stateless protocols; Signalling session states; State transitions; Keeping-state mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/1396Protocols specially adapted for monitoring users' activity

Definitions

  • a page communication method including:
  • a page communication device including:
  • the obtaining module is used to obtain the first communication request sent by the client page
  • the beneficial effect of the embodiment of the present application is that: when a communication request is initiated on the client page, a dedicated storage area is specified in the memory, and the storage area accepts the writing of the status information of the server page, and at the same time, the storage area is received by the client Page monitoring, when the server page writes the status information in the storage area, the client page obtains the change of the page status information in the storage area by monitoring, if the status information changes are monitored, according to the status information written by the server page , Adjust the status of its own page to make it consistent with the server page. Therefore, when the same status update is required between multiple different pages, the server only needs to send status change information to one of the pages, and other pages can realize the synchronous adjustment of the status by monitoring the status information change of the page. It can effectively reduce the burden on the server and avoid the waste of network resources.
  • FIG. 1 is a schematic flowchart of a page communication method according to an embodiment of the present application
  • the first communication request includes: tabid, tab page url, common password three data content, used to indicate who "I” communicates with, or "I” communicates with any page in the same domain but "my”
  • the password is xxx.
  • the data structure of the first communication request in this embodiment is not limited to this.
  • the data structure of the first communication request further includes: a callback function, which is used to complete After a communication request, a function to call back notification data to the client page.
  • a dedicated storage area is designated in the memory, and the storage area accepts the writing of the status information of the server page.
  • the storage area is monitored by the client page.
  • the client page obtains the change of the page status information in the storage area by monitoring. If the status information changes, the page status of the own page is monitored according to the status information written by the server page. Adjust so that the page status is consistent with the server page. Therefore, when the same status update is required between multiple different pages, the server only needs to send status change information to one of the pages, and other pages can realize the synchronous adjustment of the status by monitoring the status information change of the page. It can effectively reduce the burden on the server and avoid the waste of network resources.
  • the status information of the comparison result is inconsistent with the first target state, it indicates that the status content of the server page has changed.
  • the client page confirms that the status content of the server page has changed through the comparison result, and starts the status adjustment process.
  • messages can be transferred in a message manner during cross-domain communication.
  • FIG. 7 is a schematic flowchart of cross-domain communication by means of communication messages in this embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Disclosed in the present application are a page communication method and apparatus, a computer-readable storage medium and a terminal, comprising: acquiring a first communication request sent by a client page; establishing a communication connection between the client page and a server page according to the first communication request; and according to the communication connection, the client page monitoring a status change of the server page so that the page status of the client page and the server page changes synchronously. Therefore, when the same status update is required between a plurality of different pages, the server side only needs to send status change information to one of the pages, and the other pages may synchronously adjust of the status by means of monitoring changes of the status information of the page. The present invention may effectively reduce the burden on the server side and prevent the waste of network resources.

Description

页面通信方法、装置、计算机设备及存储介质Page communication method, device, computer equipment and storage medium 技术领域Technical field
本申请涉及通信技术领域,具体而言,本申请涉及一种页面通信方法、装置、计算机设备及存储介质。The present application relates to the field of communication technology. Specifically, the present application relates to a page communication method, device, computer equipment, and storage medium.
背景技术Background technique
伴随着计算机技术的发展,对于用户来讲计算机仅仅是一种办公、通信或者娱乐的工具。计算机终端作为用户直接操作的设备,计算机终端只能够向用户提供本地数据支持的服务,而用户需要获取本地数据之外的其他数据时,则需要通过互联网进行获取。With the development of computer technology, the computer is only a tool for office, communication or entertainment for users. The computer terminal is a device directly operated by the user. The computer terminal can only provide users with services supported by local data. When the user needs to obtain data other than local data, the user needs to obtain it through the Internet.
现有技术中,通过互联网获取外部数据和信息最常用的工具为浏览器,浏览器中各个页面之间相互独立,任何一个页面内容状态的变化,都需要向对应的服务器端获取数据,才能够对页面状态进行调整,因此,当一个计算机终端开启多个浏览器页面时,会对服务器端造成较大负担,同时每个页面与服务器端就相同的事项进行通信时,也会造成网络资源的浪费。In the prior art, the most commonly used tool for obtaining external data and information through the Internet is a browser, and each page in the browser is independent of each other. Any change in the status of the content of a page needs to obtain data from the corresponding server. Adjust the page status. Therefore, when a computer terminal opens multiple browser pages, it will cause a heavy burden on the server side. At the same time, when each page communicates with the server side on the same matter, it will also cause network resources. waste.
发明内容Summary of the invention
一种页面通信方法,包括:A page communication method, including:
获取客户端页面发送的第一通信请求;Obtain the first communication request sent by the client page;
根据所述第一通信请求建立所述客户端页面与服务端页面的通信连接,其中,所述通信连接为所述服务端页面在指定的存储区域内存储状态信息,所述客户端页面监听所述存储区域内的状态信息变化;Establishing a communication connection between the client page and the server page according to the first communication request, wherein the communication connection is for the server page to store state information in a designated storage area, and the client page monitors State information changes in the storage area;
根据所述通信连接所述客户端页面监听所述服务端页面的状态变化,以使所述客户端页面与所述服务端页面的页面状态同步变化。The client page monitors the status change of the server page according to the communication connection, so that the page status of the client page and the server page changes synchronously.
一种页面通信装置,包括:A page communication device, including:
获取模块,用于获取客户端页面发送的第一通信请求;The obtaining module is used to obtain the first communication request sent by the client page;
处理模块,用于根据所述第一通信请求建立所述客户端页面与服务端页面的通信连接,其中,所述通信连接为所述服务端页面在指定的存储区域内存储状态信息,所述客户端页面监听所述存储区域内的状态信息变化;A processing module, configured to establish a communication connection between the client page and the server page according to the first communication request, wherein the communication connection is for the server page to store state information in a designated storage area, the The client page monitors the change of state information in the storage area;
执行模块,用于根据所述通信连接所述客户端页面监听所述服务端页面的状态变化,以使所述客户端页面与所述服务端页面的页面状态同步变化。The execution module is configured to monitor the state change of the server page according to the communication connection, so that the page state of the client page and the server page change synchronously.
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行上述所述页面通信方法的步骤。A computer device includes a memory and a processor, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor causes the processor to perform the steps of the page communication method .
一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述所述页面通信方法的步骤。A storage medium storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, causes the one or more processors to perform the steps of the page communication method described above.
本申请实施例的有益效果是:通过在客户端页面发起通信请求时,在存储器中指定一块专属的存储区域,该存储区域接受服务端页面的状态信息写入,同时,该存储区域受到客户端页面的监听,当服务端页面在该存储区域写入状态信息后,客户端页面通过监听获取该存储区域内页面状态信息变化,若监听到状态信息变化后,根据服务端页面写入的状态信息,对自身页面状态进行调整,以使其页面状态与服务端页面一致。由此,当多个不同页面之间需要进行相同状态更新时,服务器端只需要对其中的一个页面发送状态变化信息,其他页面通过监听该页面的状态信息变化,就能够实现状态的同步调整,能够有效地减轻对于服务器端的负担,也避免了对于网络资源的浪费。The beneficial effect of the embodiment of the present application is that: when a communication request is initiated on the client page, a dedicated storage area is specified in the memory, and the storage area accepts the writing of the status information of the server page, and at the same time, the storage area is received by the client Page monitoring, when the server page writes the status information in the storage area, the client page obtains the change of the page status information in the storage area by monitoring, if the status information changes are monitored, according to the status information written by the server page , Adjust the status of its own page to make it consistent with the server page. Therefore, when the same status update is required between multiple different pages, the server only needs to send status change information to one of the pages, and other pages can realize the synchronous adjustment of the status by monitoring the status information change of the page. It can effectively reduce the burden on the server and avoid the waste of network resources.
附图说明BRIEF DESCRIPTION
图1为本申请一个实施例的页面通信方法的基本流程示意图;FIG. 1 is a schematic flowchart of a page communication method according to an embodiment of the present application;
图2为本申请一个具体实施例的客户端页面通过信息比对的方式确认状态变化信息的流程示意图;FIG. 2 is a schematic diagram of a process of confirming state change information on a client page in a specific embodiment of the present application through information comparison;
图3为本申请一具体实施例的筛选状态信息进行同步的流程示意图;FIG. 3 is a schematic flowchart of synchronization of screening status information according to a specific embodiment of the application;
图4为本申请一个实施例的通过图像比对确认状态同步效果的流程示意图;4 is a schematic flowchart of confirming the state synchronization effect through image comparison according to an embodiment of the present application;
图5为本申请一个实施例的通过神经网络模型进行相似度比对的流程示意图;FIG. 5 is a schematic flowchart of similarity comparison through a neural network model according to an embodiment of the present application;
图6为本申请一个实施例的建立跨域通信连接的流程示意图;6 is a schematic flowchart of establishing a cross-domain communication connection according to an embodiment of the present application;
图7为本申请一个实施例的通过通信消息的方式进行跨域通信的流程示意图;7 is a schematic flowchart of cross-domain communication by means of communication messages according to an embodiment of the present application;
图8为本申请一个实施例的页面通信装置基本结构示意图;8 is a schematic diagram of a basic structure of a page communication device according to an embodiment of the application;
图9为本申请一个实施例的计算机设备的基本结构框图。9 is a block diagram of a basic structure of a computer device according to an embodiment of the present application.
具体实施方式detailed description
如图1所示,一种页面通信方法,包括:As shown in FIG. 1, a page communication method includes:
S1100、获取客户端页面发送的第一通信请求;S1100: Obtain the first communication request sent by the client page;
具有相同域名的浏览器或者APP中,同时开启多个页面,例如,在浏览器中进入“X猫”网上商城后,开启商城内不同卖家的页面进行浏览或者直播平台中开启多个主播直播间进行观看时,上述卖家的多个页面均具有相同的域名,多个主播直播间也具有相同的域名。即上述多个页面或者多个直播窗口具有相同域名。Open multiple pages at the same time in a browser or APP with the same domain name, for example, after entering the "X-Cat" online store in the browser, open the pages of different sellers in the store to browse or open multiple live broadcast rooms in the live broadcast platform When viewing, multiple pages of the seller have the same domain name, and multiple live broadcast rooms also have the same domain name. That is, the above multiple pages or multiple live broadcast windows have the same domain name.
客户端页面是指在具有相同的域名的页面中通过监听的方式获取状态信息的页面或者窗口。本实施方式中,客户端页面的载体能够 是浏览器、APP或办公软件等各类应用程序。The client page refers to a page or window that obtains status information by monitoring in a page with the same domain name. In this embodiment, the carrier of the client page can be various applications such as a browser, APP, or office software.
第一通信请求是客户端页面发出的请求连接指定的同域页面(服务端页面)的请求消息。需要指出的是,本实施方式中,客户端页面能够指定监听一个同域页面,也能够监听多个同域页面,例如,两个、三个、四个或者更多的同域页面,上述同域页面统称为客户端页面的服务端页面。The first communication request is a request message sent by the client page requesting to connect to the specified domain page (server page). It should be noted that, in this embodiment, the client page can specify to monitor one page in the same domain, and can also monitor multiple pages in the same domain, for example, two, three, four, or more pages in the same domain. Domain pages are collectively called server pages of client pages.
在一些实施方式中,第一通信请求包括:tabid,tab页面url,普通口令三个数据内容,用来表示“我”和谁通信,或者“我”和任何同域页面通信但是“我”的口令是xxx。但是,本实施方式中第一通信请求的数据构造不局限于此,在一些实施方式中,第一通信请求的数据结构中还包括:回调函数,回调函数用于在客户端页面处理完成该第一通信请求后,回调通知数据至客户端页面的函数。In some embodiments, the first communication request includes: tabid, tab page url, common password three data content, used to indicate who "I" communicates with, or "I" communicates with any page in the same domain but "my" The password is xxx. However, the data structure of the first communication request in this embodiment is not limited to this. In some embodiments, the data structure of the first communication request further includes: a callback function, which is used to complete After a communication request, a function to call back notification data to the client page.
S1200、根据所述第一通信请求建立所述客户端页面与服务端页面的通信连接,其中,所述通信连接为所述服务端页面在指定的存储区域内存储状态信息,所述客户端页面监听所述存储区域内的状态信息变化;S1200. Establish a communication connection between the client page and the server page according to the first communication request, where the communication connection is for the server page to store state information in a designated storage area, and the client page Monitoring the change of state information in the storage area;
服务端页面在接收到第一通信请求后,对第一通信请求进行处理,其处理结果为建立了客户端页面与服务端页面之间的通信连接。After receiving the first communication request, the server page processes the first communication request, and the processing result is that a communication connection between the client page and the server page is established.
通信连接为服务端页面在存储器中指定一块存储区域,该存储区域一旦设定永久可用(浏览器或者其他应用程序关闭,然后重新打开后数据仍然存在,需要通过手动清理才能够擦除)。该存储区域建立后,服务端页面能够向该存储区域内存储其接收到的服务器端发送的状态变化信息。The communication link specifies a storage area in the memory for the server-side page. Once the storage area is set to be permanently available (the browser or other applications are closed and then reopened, the data still exists, and it needs to be manually cleared before it can be erased). After the storage area is established, the server page can store the state change information sent by the server side to the storage area.
客户端页面是指在具有相同的域名的页面中通过发布自身的状态变化信息,使监控它的客户端页面进行同步状态调整的页面或者窗口。需要指出的是,客户端页面能够直接通过服务器端获取状态变化信息,也能够通过监听其他服务端页面获取状态变化信息。服务端页面能够与一个或者多个客户端页面建立通信连接,The client page refers to a page or window that allows the client page that monitors it to adjust the synchronization status by publishing its own status change information on a page with the same domain name. It should be noted that the client page can directly obtain the status change information through the server, and can also obtain the status change information by monitoring other server pages. The server page can establish a communication connection with one or more client pages,
本实施方式中,状态变化信息是指(不限于)页面或者窗口中开启或者关闭某些功能模块、变换页面或者窗口的显示颜色、系统的通知消息或页面通用数据变化等等。In this embodiment, the state change information refers to (not limited to) turning on or off certain function modules in the page or window, changing the display color of the page or window, system notification messages, or changes in page general data, and so on.
S1300、根据所述通信连接所述客户端页面监听所述服务端页面的状态变化,以使所述客户端页面与所述服务端页面的页面状态同步变化。S1300. The client page monitors the status change of the server page according to the communication connection, so that the page status of the client page and the server page changes synchronously.
当客户端页面与服务端页面通过监听的方式建立通信连接后,客户端通过定时检测的方式存储区域内存储的状态信息是否发生变化,若发生变化,客户端页面则获取该存储区域内的状态信息,并根据该状态信息调整自身状态;若未发生变化,则继续保持当前的显示状态, 并在下一个比对时间内进行状态信息比对。在一些实施方式中,客户端页面的状态更新采用通知响应机制,当服务端页面将新的状态数据写入后,触发存储区域内的消息通知设置,向客户端页面发送更新消息,客户端页面接收到该更新消息后,提取存储区域内新的状态消息。After the client page and the server page establish a communication connection by monitoring, the client periodically detects whether the status information stored in the area has changed. If there is a change, the client page obtains the status in the storage area Information, and adjust its own state according to the state information; if there is no change, continue to maintain the current display state, and compare the state information within the next comparison time. In some embodiments, the status update of the client page uses a notification response mechanism. When the server page writes new status data, it triggers the message notification setting in the storage area to send the update message to the client page. The client page After receiving the update message, the new status message in the storage area is extracted.
在一些实施方式中,服务端页面能够将所有页面状态信息写入至存储区域,但是,客户端页面能够根据设定的需求对更新内容进行筛选,然后根据筛选结果选取符合设定需要的状态信息进行同步,对于不符合设定需求的状态信息予以摒弃。In some embodiments, the server page can write all page status information to the storage area, but the client page can filter the updated content according to the set requirements, and then select the state information that meets the set requirements according to the filtering results Synchronize and discard status information that does not meet the set requirements.
上述实施方式通过在客户端页面发起通信请求时,在存储器中指定一块专属的存储区域,该存储区域接受服务端页面的状态信息写入,同时,该存储区域受到客户端页面的监听,当服务端页面在该存储区域写入状态信息后,客户端页面通过监听获取该存储区域内页面状态信息变化,若监听到状态信息变化后,根据服务端页面写入的状态信息,对自身页面状态进行调整,以使其页面状态与服务端页面一致。由此,当多个不同页面之间需要进行相同状态更新时,服务器端只需要对其中的一个页面发送状态变化信息,其他页面通过监听该页面的状态信息变化,就能够实现状态的同步调整,能够有效地减轻对于服务器端的负担,也避免了对于网络资源的浪费。In the above embodiment, when a communication request is initiated on the client page, a dedicated storage area is designated in the memory, and the storage area accepts the writing of the status information of the server page. At the same time, the storage area is monitored by the client page. After the end page writes the status information in the storage area, the client page obtains the change of the page status information in the storage area by monitoring. If the status information changes, the page status of the own page is monitored according to the status information written by the server page. Adjust so that the page status is consistent with the server page. Therefore, when the same status update is required between multiple different pages, the server only needs to send status change information to one of the pages, and other pages can realize the synchronous adjustment of the status by monitoring the status information change of the page. It can effectively reduce the burden on the server and avoid the waste of network resources.
在一些实施方式中,客户端页面在监听信息时,通过定时比对的方式确认存储区域内是否发生状态信息的变化。请参阅图2,图2为本实施例客户端页面通过信息比对的方式确认状态变化信息的流程示意图。In some embodiments, when monitoring information on the client page, it is confirmed whether a change in status information occurs in the storage area through a time comparison. Please refer to FIG. 2. FIG. 2 is a schematic flowchart of the process of confirming the status change information on the client page through information comparison in this embodiment.
如图2所示,图1所示的步骤S1300具体包括:As shown in FIG. 2, step S1300 shown in FIG. 1 specifically includes:
S1311、获取所述存储区域内的状态信息;S1311: Obtain state information in the storage area;
客户端页面在一个采集比对时间节点到来时,读取指定的存储区域内的表征服务端页面状态内容的状态信息。例如,客户端页面每隔0.5s读取一次存储区域内的状态信息,但是客户端页面读取状态信息的频率不限于此,根据具体应用场景的不同,客户端页面能够以更小时间间隔或者更大时间间隔读取状态信息。When a collection and comparison time node arrives, the client page reads the state information representing the state content of the server page in the designated storage area. For example, the client page reads the status information in the storage area every 0.5s, but the frequency of reading the status information on the client page is not limited to this. Depending on the specific application scenario, the client page can be at a smaller time interval or Read status information at larger intervals.
S1312、将所述状态信息与预设的第一目标状态进行性比对;S1312: Compare the state information with a preset first target state;
将当前采集节点内采集的状态信息与第一目标状态进行比对,其中,第一目标状态为上一个采集结点采集的状态信息。即比对前后两个采集节点的状态信息是否一致。比对的方式包括文件命名比对和内容比对,文件命名比对即比对两个状态信息的命名是否一致,而内容比对比对则是通过比对两个状态信息的信息内容是否一致,比对的方式能够通过汉明距离或者海明距离进行比对。Compare the state information collected in the current collection node with the first target state, where the first target state is the state information collected by the last collection node. That is, check whether the status information of the two collection nodes before and after is consistent. The comparison method includes file naming comparison and content comparison. The file naming comparison means comparing the naming of the two status information, and the content comparison is to compare whether the information content of the two status information is consistent. The comparison method can be compared by Hamming distance or Hamming distance.
S1313、当所述状态信息与所述第一目标状态不一致时,确认所述存储区域存储的状态信息发生变化。S1313. When the state information is inconsistent with the first target state, confirm that the state information stored in the storage area has changed.
当比对的结果状态信息与第一目标状态不一致时,即表明服务端页面的状态内容发生了变化,客户端页面通过比对结果确认服务端页面的状态内容发生了变化,开启状态调整流程。When the status information of the comparison result is inconsistent with the first target state, it indicates that the status content of the server page has changed. The client page confirms that the status content of the server page has changed through the comparison result, and starts the status adjustment process.
通过对存储区域进行监听,比对状态信息是否一致的方式,快速的确定存储区域内页面状态信息的变化,能够快速获知状态信息的变化,实现状态同步。By monitoring the storage area and comparing whether the status information is consistent, you can quickly determine the change of the page status information in the storage area, you can quickly learn the status information changes, and achieve status synchronization.
在一些实施方式中,对于服务端页面的状态变化,客户端页面不需要进行完全同步,仅需要对设定格式的或者内容的状态变化进行同步。请参阅图3,图3为本实施例筛选状态信息进行同步的流程示意图。In some embodiments, for the state change of the server page, the client page does not need to be completely synchronized, but only needs to synchronize the state change of the format or content. Please refer to FIG. 3, which is a schematic diagram of a process of synchronizing the screening status information of this embodiment.
请参阅图3,图2所示步骤S1313之后包括:Please refer to FIG. 3, after step S1313 shown in FIG. 2 includes:
S1321、获取所述存储区域内的状态变化信息;S1321: Obtain state change information in the storage area;
当确认存储区域内的状态信息发生变化后,定义该存储区域内更新后的状态信息为状态变化信息。读取该状态变化信息以识别该状态变化信息是否为设定的状态变化。When it is confirmed that the status information in the storage area has changed, the updated status information in the storage area is defined as status change information. The state change information is read to identify whether the state change information is a set state change.
S1322、根据预设的状态列表识别所述状态变化信息是否为预设的第二目标状态;S1322: Identify whether the state change information is a preset second target state according to a preset state list;
根据设定的状态列表识别该状态变化信息是否为预设的第二目标状态。其中,状态列表是根据客户端页面的状态变化需求设定的,记录客户端页面状态变化类型形成的列表。第二目标状态即客户端页面指定的需要进行同步变化的状态类型。通过将获取的状态变化信息与状态列表进行比对,就能够确定出该状态变化信息所表征的状态类型是否为客户端页面的指定的状态变化类型。According to the set state list, identify whether the state change information is a preset second target state. Among them, the state list is set according to the state change requirement of the client page, and the list formed by recording the state change type of the client page. The second target state is the type of state specified on the client page that needs to be changed synchronously. By comparing the obtained state change information with the state list, it can be determined whether the state type represented by the state change information is the specified state change type of the client page.
S1323、当所述状态变化信息表征的内容与所述第二目标状态的内容一致时,所述客户端页面根据所述状态变化信息调整页面内容。S1323. When the content characterized by the state change information is consistent with the content of the second target state, the client page adjusts the page content according to the state change information.
当状态变化信息表征的内容与第二目标状态的内容一致时,即表明状态变化信息表征的状态类型与客户端页面设定的变化类型一致,客户端需要根据状态变化信息表征的状态类型进行状态同步,以达到跟随调整页面内容的目的。When the content represented by the state change information is consistent with the content of the second target state, it indicates that the state type represented by the state change information is consistent with the change type set on the client page, and the client needs to perform the state according to the state type represented by the state change information. Synchronization to achieve the purpose of following and adjusting the page content.
举例说明,通过StorageEvent(存储事件)响应存储的变化无论何时,Storage对象(状态信息)发生变化时(即创建/更新/删除数据项时,重复设置相同的键值不会触发该事件。)只有在状态变化发生指定变化时,例如一个新标签才会发生变化。For example, in response to changes in storage through StorageEvent, whenever the Storage object (status information) changes (that is, when creating/updating/deleting data items, repeatedly setting the same key value will not trigger the event.) Only when a specified change occurs in a state change, for example, a new label will change.
又例如,在一些实施方式中,用户通过浏览器打开网上商城进行购物,由于该用户账号之前的购物行为,网上商城向该用户账户开启抽奖奖励,提示该用户进行抽奖的提示模块会在该网上商城所有的页面进行展示。则设定相同域名页面中的所有页面均监听其他页面中抽奖模块的状态。对于出抽奖模块状态之外其他的状态变化均不予同步, 此时,若用户通过某个页面进入到抽奖中心完成抽奖,则该页面的抽奖提示模块状态变化为关闭状态,该状态更新信息会被其他页面监听到,并进行同步执行,关闭各自页面中抽奖提示模块,完成选择性的数据同步。For another example, in some embodiments, the user opens the online store through a browser to make a purchase. Due to the previous shopping behavior of the user account, the online store opens a lottery reward to the user account, and a prompt module prompting the user to perform the lottery will be available on the online All pages of the mall are displayed. Then set all pages in the same domain name page to monitor the status of the lottery module in other pages. The status changes other than the status of the lottery drawing module are not synchronized. At this time, if the user enters the lottery center through a page to complete the lottery draw, the status of the lottery reminder module of the page changes to the closed state, and the status update information will be It is monitored by other pages, and it is executed synchronously. The lottery prompt module in each page is closed to complete selective data synchronization.
通过设定选择性同步条件,使客户端页面具有选择性的同步服务端页面的状态变化,保证各个同域页面之间的个性化内容,减少数据交互频次,释放终端运行负担。By setting selective synchronization conditions, the client page can selectively synchronize the status changes of the server page, ensure personalized content between pages in the same domain, reduce the frequency of data interaction, and release the terminal's operating burden.
在一些实施方式中,为检测页面之间状态调整的成果,需要对状态同步后的页面内容进行图像比对,以确认状态同步的效果。请参阅图4,图4为本实施例通过图像比对确认状态同步效果的流程示意图。In some embodiments, in order to detect the results of state adjustment between pages, it is necessary to perform image comparison on the content of the page after state synchronization to confirm the effect of state synchronization. Please refer to FIG. 4, which is a schematic diagram of a process for confirming a state synchronization effect through image comparison in this embodiment.
如图4所示,图3所示的S1323步骤之后,包括:As shown in FIG. 4, after step S1323 shown in FIG. 3, it includes:
S1410、获取所述客户端页面的第一页面截图和所述服务端页面的第二页面截图;S1410: Acquire a screenshot of the first page of the client page and a screenshot of the second page of the server page;
当客户端页面完成状态同步后,截取客户端页面的第一页面截图和服务端页面的第二页面截图。其中,第一页面截图和第二页面截图能够是客户端页面和服务端页面的完整页面截图,也能够是客户端页面和服务端页面状态变化位置所在区域内的局部地址。After the client page completes the state synchronization, a screenshot of the first page of the client page and a screenshot of the second page of the server page are taken. The first page screenshot and the second page screenshot can be a complete page screenshot of the client page and the server page, or can be a local address in the area where the status changes of the client page and the server page are located.
S1420、比对第一页面截图与所述第二页面截图之间的相似度;S1420. Compare the similarity between the first page screenshot and the second page screenshot;
通过图像比对的方式进行对第一页面截图与第二页面截图之间的相似度,比对方式能够为通过轮廓比对法、重叠比对法或者神经网络模型对两幅截图的相似性进行比对,比得到两幅截图的相似度。The similarity between the first page screenshot and the second page screenshot is performed by image comparison. The comparison method can be the similarity of the two screenshots by the contour comparison method, overlap comparison method or neural network model Compare, get the similarity of the two screenshots.
S1430、当所述相似度小于预设的第一阈值时,重新对所述客户端页面的页面内容进行调整。S1430. When the similarity is less than the preset first threshold, re-adjust the page content of the client page.
将比对得到的相似度与设定的第一阈值进行比对,其中,第一阈值为设定的用于衡量第一截图画面与第二截图画面之间最低相似标准的数值,例如,80%。但是,第一阈值的取值不局限于此,根据具体应用场景的不同,能够对第一阈值的取值范围选择性设定,由于,第一阈值的取值和第一截图画面与第二截图画面之间相似度的要求成正比,因此,第一阈值的取值参考第一截图画面与第二截图画面之间相似度的需求加以设定。Compare the similarity obtained by the comparison with the set first threshold, where the first threshold is a set value used to measure the lowest similarity standard between the first screenshot and the second screenshot, for example, 80 %. However, the value of the first threshold is not limited to this. Depending on the specific application scenario, the value range of the first threshold can be set selectively, because the value of the first threshold and the first screenshot image and the second The requirements for the similarity between screenshot pictures are proportional to each other. Therefore, the value of the first threshold is set with reference to the requirements for the similarity between the first screenshot pictures and the second screenshot pictures.
当相似度小于预设的第一阈值时,重新对客户端页面的页面内容进行调整。重新调整时客户端页面重新读取状态变化信息,并根据状态变化信息表征的状态内容进行状态调整。When the similarity is less than the preset first threshold, the page content of the client page is adjusted again. During the readjustment, the client page reads the state change information again, and adjusts the state according to the state content represented by the state change information.
通过进行图像比对,能够快速的识别出客户端页面与服务端页面状态同步后是否存在差距,能够有效的避免由于信息错误导致的同步失误问题。Through image comparison, it is possible to quickly identify whether there is a gap between the status of the client page and the server page after synchronization, which can effectively avoid the problem of synchronization errors caused by information errors.
在一些实施方式中,需要通过神经网络模型对第一截图画面与第二截图画面进行相似度比对。请参阅图5,图5为本实施例通过神经 网络模型进行相似度比对的流程示意图。In some embodiments, a similarity comparison between the first screenshot and the second screenshot needs to be performed through a neural network model. Please refer to FIG. 5, which is a schematic diagram of a similarity comparison process using a neural network model in this embodiment.
如图5所示,图4所示的步骤S1420包括:As shown in FIG. 5, step S1420 shown in FIG. 4 includes:
S1421、将所述第一截图画面与所述第二截图画面输入至预设的相似度判断模型中,其中,所述相似度判断模型为预先训练至收敛状态,用于对图片相似度进行判断的神经网络模型;S1421: Input the first screenshot picture and the second screenshot picture into a preset similarity judgment model, wherein the similarity judgment model is pre-trained to a converged state, used for judging the similarity of pictures Neural network model;
将第一截图画面与第二截图画面输入至预设的相似度判断模型中进行相似度比对。其中,相似性判断模型为预先训练至收敛状态的神经网络模型。相似度判断模型能够为已经训练至收敛状态的卷积神经网络模型(CNN),但是,不局限于此,相似度判断模型还能够是:深度神经网络模型(DNN)、循环神经网络模型(RNN)或者上述三种网络模型的变形模型。The first screenshot picture and the second screenshot picture are input into a preset similarity judgment model for similarity comparison. Among them, the similarity judgment model is a neural network model trained in advance to a convergence state. The similarity judgment model can be a convolutional neural network model (CNN) that has been trained to a convergence state, but, not limited to this, the similarity judgment model can also be: deep neural network model (DNN), recurrent neural network model (RNN ) Or the deformation models of the above three network models.
作为相似度判断模型的初始神经网络模型在训练时,通过收集大量的图片作为训练样本,训练样本以图相对的方式进行呈现,即一个训练样本中包括两张图片,两张图片的内容能够是完全不同、局部相似或者完全相同,通过人工在观察了训练样本的中两张图片的相似程度后,对各个训练样本进行标定(标定是指训练样本中两张图像之间人为认定的相似度)。然后将训练样本输入到初始的神经网络模型中,并获取模型输出的分类结果(分类结果为模型得到的训练样本的相似度),并通过神经网络模型的损失函数计算该分类结果与标定结果之间的距离(例如:欧氏距离、马氏距离或余弦距离等),将计算结果与设定的距离阈值进行比对,若计算结果小于等于距离阈值则通过验证,继续进行下一个训练样本的训练,若计算结果大于距离阈值则通过损失函数计算二者之间的差值,并通过反向传播校正神经网络模型内的权值,使神经网络模型能够提高训练样本中能够准确表达二者相似度的像素点的权重,以此,增大判断的准确率。通过循环执行上述方案和大量的训练样本训练后,训练得到的神经网络模型对图像相似度之间的判断准确率大于一定数值的,例如,96%,则该神经网络模型训练至收敛状态,则该训练至收敛的神经网络即为相似度判断模型。During training, the initial neural network model as a similarity judgment model collects a large number of pictures as training samples, and the training samples are presented in a relative manner to the pictures, that is, one training sample includes two pictures, and the content of the two pictures can be Completely different, partially similar or completely the same, after manually observing the similarity of the two pictures in the training sample, calibrate each training sample (calibration refers to the artificially determined similarity between the two images in the training sample) . Then input the training sample into the initial neural network model, and obtain the classification result of the model output (the classification result is the similarity of the training sample obtained by the model), and calculate the classification result and the calibration result through the loss function of the neural network model The distance between them (for example: Euclidean distance, Mahalanobis distance, cosine distance, etc.), compare the calculation result with the set distance threshold, if the calculation result is less than or equal to the distance threshold, then pass the verification and continue to the next training sample Training, if the calculation result is greater than the distance threshold, the difference between the two is calculated through the loss function, and the weights in the neural network model are corrected by back propagation, so that the neural network model can improve the training sample and can accurately express the similarity between the two. The weight of the pixels of degree is used to increase the accuracy of judgment. After training by looping through the above scheme and a large number of training samples, if the accuracy of the neural network model obtained by the training to the image similarity is greater than a certain value, for example, 96%, then the neural network model is trained to the convergence state, then The neural network trained to convergence is the similarity judgment model.
训练至收敛状态的相似度判断模型能够准确的判断第一截图画面与第二截图画面之间的相似度。The similarity judgment model trained to the convergence state can accurately judge the similarity between the first screenshot picture and the second screenshot picture.
S1422、获取所述相似度判断模型输出的分类结果,其中,所述分类结果表征所述第一页面截图与所述第二页面截图之间的相似度。S1422: Obtain a classification result output by the similarity judgment model, where the classification result represents the similarity between the first page screenshot and the second page screenshot.
由于,相似度判断模型的分类结果为相似度,例如,相似度小于60%、70%、80%、90%和100%等。通过获取相似度判断模型输出的分类结果就能够得知第一页面截图与第二页面截图之间的相似度。Since the classification result of the similarity judgment model is similarity, for example, the similarity is less than 60%, 70%, 80%, 90%, and 100%. The similarity between the screenshot of the first page and the screenshot of the second page can be known by obtaining the classification result output by the similarity judgment model.
通过神经网络模型对第一页面截图与第二页面截图之间的相似度进行判断,能够快速准确的得到二值之间的相似度数值。By judging the similarity between the first page screenshot and the second page screenshot through the neural network model, the similarity value between the two values can be quickly and accurately obtained.
在一些实施方式中,当客户端页面需要进行跨域进行状态同步或 者消息传递时,需要通过建立跨域通信连接。请参阅图6,图6为本实施例建立跨域通信连接的流程示意图。In some embodiments, when the client page needs to perform cross-domain state synchronization or message delivery, it is necessary to establish a cross-domain communication connection. Please refer to FIG. 6, which is a schematic flowchart of establishing a cross-domain communication connection in this embodiment.
如图6所示,图5所示S1300步骤之后包括:As shown in FIG. 6, after step S1300 shown in FIG. 5 includes:
S1510、获取所述客户端页面发送的第二通信请求,其中,所述第二通信请求为跨域通信请求;S1510: Obtain a second communication request sent by the client page, where the second communication request is a cross-domain communication request;
客户端页面需要进行跨域状态同步或者数据交流时,客户端对票据页面发送第二通信请求。其中,包括:tabid,tab页面url,普通口令三个数据内容,用来表示“我”和谁通信,或者“我”和任何同域页面通信但是“我”的口令是xxx。When the client page needs to perform cross-domain state synchronization or data exchange, the client sends a second communication request to the ticket page. Among them, there are three data contents: tabid, tab page url, and ordinary password, which are used to indicate who "I" communicates with, or "I" communicates with any page in the same domain but the password of "I" is xxx.
本实施方式中,票据页面为浏览器内的内联框架为IFRAME。IFRAME是HTML标签,作用是文档中的文档,或者浮动的框架(FRAME)。iframe元素会创建包含另外一个文档的内联框架(即行内框架)。<iframe>标签规定一个内联框架。一个内联框架被用来在当前HTML文档(客户端页面)中嵌入另一个文档(跨域的服务端页面)。本实施方式中,跨域是指客户端页面与服务端页面之间不具有相同的域名,例如,客户端页面表征的页面内容为“X猫”的网络页面,服务端页面表征的页面内容为“苏X易购”的网络页面。In this embodiment, the invoice frame in the browser page is IFRAME. IFRAME is an HTML tag that functions as a document in a document, or a floating frame (FRAME). The iframe element creates an inline frame (that is, an inline frame) that contains another document. The <iframe> tag specifies an inline frame. An inline framework is used to embed another document (cross-domain server page) in the current HTML document (client page). In this embodiment, cross-domain refers to that the client page and the server page do not have the same domain name. For example, the page content represented by the client page is a "X-cat" web page, and the page content represented by the server page is The web page of "Su Xesco".
S1520、将所述第二通信请求通过预设的票据页面发送至跨域通信页面建立跨域通信连接,其中,所述票据页面为嵌入所述客户端页面和所述跨域通信页面的内联框架。S1520. Send the second communication request to a cross-domain communication page through a preset ticket page to establish a cross-domain communication connection, where the ticket page is an inline embedded in the client page and the cross-domain communication page frame.
由于,既能够嵌入至客户端页面又能够嵌入至服务端页面。因此,当客户端页面发送第二通信请求后,根据第二通信请求内容中的表征服务端页面位置的URL,能够将第二通信请求发送至跨域的服务端页面。服务端页面在接收到第二通信请求后,原路返回数据至客户端页面完成跨域通信连接。Because it can be embedded in both the client page and the server page. Therefore, after the client page sends the second communication request, the second communication request can be sent to the cross-domain server page according to the URL characterizing the location of the server page in the content of the second communication request. After receiving the second communication request, the server page returns data to the client page to complete the cross-domain communication connection.
通过票据页面的设置能够使不同域名的页面之间建立通信连接进行数据交换,时跨域之间的数据传输也状态同步成为可能。例如,通过“苏X易购”在“X猫”内的网店进行交易时,如何将在“X猫”的订单和支付信息同步发送至“苏X易购”,完成两个数据库之间订单和支付信息同步时,就能够采用跨域通信实现。能够极大的节约网络资源。By setting the bill page, a communication connection can be established between pages with different domain names for data exchange, and data transmission between domains can also be synchronized in time. For example, how to send the order and payment information in "X Cat" to "Su X E-commerce" synchronously through the "Su X-Ease" online store in "X-Cat" to complete the two databases When the order and payment information are synchronized, cross-domain communication can be used. Can greatly save network resources.
在一些实施方式中,跨域通信时能够采用消息的方式进行消息传递。请参阅图7,图7为本实施例通过通信消息的方式进行跨域通信的流程示意图。In some embodiments, messages can be transferred in a message manner during cross-domain communication. Please refer to FIG. 7, which is a schematic flowchart of cross-domain communication by means of communication messages in this embodiment.
如图7所示,图6所示的S1520的步骤包括:As shown in FIG. 7, the steps of S1520 shown in FIG. 6 include:
S1521、将所述第二通信请求转化为通信消息,其中,所述通信消息中包括作为通信目标的所述跨域通信页面的通信地址;S1521: Convert the second communication request into a communication message, where the communication message includes a communication address of the cross-domain communication page as a communication target;
在进行跨域消息传播时,将第二通信请求中的内容转化为通信消 息,以通信消息的格式进行数据传输,其中,消息中包括作为通信目标的跨域通信页面(跨域服务端页面)的通信地址(URL)。During cross-domain message propagation, the content in the second communication request is converted into a communication message, and data transmission is performed in the format of the communication message, where the message includes a cross-domain communication page (cross-domain server page) as a communication target Address (URL).
S1522、根据所述通信地址所述票据页面将所述通信消息转发至所述跨域通信页面,以使所述客户端页面与所述跨域通信页面建立跨域通信连接。S1522: Forward the communication message to the cross-domain communication page according to the communication page and the ticket page, so that the client page establishes a cross-domain communication connection with the cross-domain communication page.
票据页面采用window.postMessage()方法可以安全地实现跨源通信。window.postMessage()方法被调用时,会在客户端页面脚本执行完毕之后(发出第二通信请求),根据通信地址向服务端页面派发一个MessageEvent消息,建立跨域通信连接。服务端页面向客户端页面发送消息时,也通过相同的方式进行消息传递。The ticket page uses the window.postMessage() method to safely implement cross-origin communication. When the window.postMessage() method is called, a MessageEvent message is dispatched to the server page according to the communication address after the execution of the client page script is completed (a second communication request is issued) to establish a cross-domain communication connection. When the server page sends a message to the client page, the message is also passed in the same way.
如图8所示,一种页面通信装置,包括:获取模块2100、处理模块2200和执行模块2300。获取模块2100用于获取客户端页面发送的第一通信请求;处理模块2200用于根据第一通信请求建立客户端页面与服务端页面的通信连接,通信连接为服务端页面在指定的存储区域内存储状态信息,客户端页面监听存储区域内的状态信息变化;执行模块2300用于根据通信连接客户端页面监听服务端页面的状态变化,以使客户端页面与服务端页面的页面状态同步变化。As shown in FIG. 8, a page communication device includes: an acquisition module 2100, a processing module 2200, and an execution module 2300. The obtaining module 2100 is used to obtain the first communication request sent by the client page; the processing module 2200 is used to establish a communication connection between the client page and the server page according to the first communication request, and the communication connection is that the server page is in a designated storage area Storing state information, the client page monitors the change of state information in the storage area; the execution module 2300 is used to monitor the state change of the server page according to the communication connection client page, so that the page state of the client page and the server page changes synchronously.
页面通信装置通过在客户端页面发起通信请求时,在存储器中指定一块专属的存储区域,该存储区域接受服务端页面的状态信息写入,同时,该存储区域受到客户端页面的监听,当服务端页面在该存储区域写入状态信息后,客户端页面通过监听获取该存储区域内页面状态信息变化,若监听到状态信息变化后,根据服务端页面写入的状态信息,对自身页面状态进行调整,以使其页面状态与服务端页面一致。由此,当多个不同页面之间需要进行相同状态更新时,服务器端只需要对其中的一个页面发送状态变化信息,其他页面通过监听该页面的状态信息变化,就能够实现状态的同步调整,能够有效地减轻对于服务器端的负担,也避免了对于网络资源的浪费。The page communication device designates a dedicated storage area in the memory by initiating a communication request on the client page. The storage area accepts the writing of the status information of the server page. At the same time, the storage area is monitored by the client page. After the end page writes the status information in the storage area, the client page obtains the change of the page status information in the storage area by monitoring. If the status information changes, the page status of the own page is monitored according to the status information written by the server page. Adjust so that the page status is consistent with the server page. Therefore, when the same status update is required between multiple different pages, the server only needs to send status change information to one of the pages, and other pages can realize the synchronous adjustment of the status by monitoring the status information change of the page. It can effectively reduce the burden on the server and avoid the waste of network resources.
在一些实施方式中,页面通信装置还包括:第一获取子模块、第一处理子模块和第一执行子模块。其中,第一获取子模块用于获取存储区域内的状态信息;第一处理子模块用于将状态信息与预设的第一目标状态进行性比对;第一执行子模块用于当状态信息与第一目标状态不一致时,确认存储区域存储的状态信息发生变化。In some embodiments, the page communication device further includes: a first acquisition submodule, a first processing submodule, and a first execution submodule. Among them, the first acquisition sub-module is used to acquire the state information in the storage area; the first processing sub-module is used to compare the state information with the preset first target state; the first execution sub-module is used to check the state information When it is inconsistent with the first target state, it is confirmed that the state information stored in the storage area has changed.
在一些实施方式中,页面通信装置还包括:第二获取子模块、第二处理子模块和第二执行子模块。其中,第二获取子模块用于获取存储区域内的状态变化信息;第二处理子模块用于根据预设的状态列表识别状态变化信息是否为预设的第二目标状态;第二执行子模块用于当状态变化信息表征的内容与第二目标状态的内容一致时,客户端页面根据状态变化信息调整页面内容。In some embodiments, the page communication device further includes: a second acquisition submodule, a second processing submodule, and a second execution submodule. The second acquisition submodule is used to acquire state change information in the storage area; the second processing submodule is used to identify whether the state change information is the preset second target state according to the preset state list; the second execution submodule When the content characterized by the state change information is consistent with the content of the second target state, the client page adjusts the page content according to the state change information.
在一些实施方式中,页面通信装置还包括:第三获取子模块、第三处理子模块和第三执行子模块。其中,第三获取子模块用于获取客户端页面的第一页面截图和服务端页面的第二页面截图;第三处理子模块用于比对第一页面截图与第二页面截图之间的相似度;第三执行子模块用于当相似度小于预设的第一阈值时,重新对客户端页面的页面内容进行调整。In some embodiments, the page communication device further includes: a third acquisition submodule, a third processing submodule, and a third execution submodule. Among them, the third acquisition submodule is used to acquire the first page screenshot of the client page and the second page screenshot of the server page; the third processing submodule is used to compare the similarity between the first page screenshot and the second page screenshot The third execution submodule is used to re-adjust the page content of the client page when the similarity is less than the preset first threshold.
在一些实施方式中,页面通信装置还包括:第四处理子模块和第四执行子模块。其中,第四处理子模块用于将第一截图画面与第二截图画面输入至预设的相似度判断模型中,其中,相似度判断模型为预先训练至收敛状态,用于对图片相似度进行判断的神经网络模型;第四执行子模块用于获取相似度判断模型输出的分类结果,其中,分类结果表征第一页面截图与第二页面截图之间的相似度。In some embodiments, the page communication device further includes: a fourth processing submodule and a fourth execution submodule. Among them, the fourth processing sub-module is used to input the first screenshot picture and the second screenshot picture into a preset similarity judgment model, wherein the similarity judgment model is pre-trained to a convergent state, and is used to carry out the similarity of the pictures Neural network model for judgment; the fourth execution submodule is used to obtain the classification result output by the similarity judgment model, wherein the classification result represents the similarity between the screenshot of the first page and the screenshot of the second page.
在一些实施方式中,页面通信装置还包括:第四获取子模块和第五处理子模块。其中,第四获取子模块获取客户端页面发送的第二通信请求,其中,第二通信请求为跨域通信请求;第五处理子模块用于将第二通信请求通过预设的票据页面发送至跨域通信页面建立跨域通信连接,其中,票据页面为嵌入客户端页面和跨域通信页面的内联框架。In some embodiments, the page communication device further includes: a fourth acquisition submodule and a fifth processing submodule. Wherein, the fourth obtaining sub-module obtains the second communication request sent by the client page, wherein the second communication request is a cross-domain communication request; the fifth processing sub-module is used to send the second communication request to the preset ticket page to The cross-domain communication page establishes a cross-domain communication connection, where the ticket page is an inline frame embedded in the client page and the cross-domain communication page.
在一些实施方式中,页面通信装置还包括:第六处理子模块和第五执行子模块。其中,第六处理子模块用于将第二通信请求转化为通信消息,其中,通信消息中包括作为通信目标的跨域通信页面的通信地址;第五执行子模块用于根据通信地址票据页面将通信消息转发至跨域通信页面,以使客户端页面与跨域通信页面建立跨域通信连接。In some embodiments, the page communication device further includes: a sixth processing submodule and a fifth execution submodule. Among them, the sixth processing submodule is used to convert the second communication request into a communication message, where the communication message includes the communication address of the cross-domain communication page as the communication target; the fifth execution submodule is used to convert the The communication message is forwarded to the cross-domain communication page, so that the client page establishes a cross-domain communication connection with the cross-domain communication page.
本申请实施例还提供一种终端,所述终端包括:An embodiment of the present application further provides a terminal, and the terminal includes:
一个或多个处理器;One or more processors;
存储装置,用于存储一个或多个程序,Storage device for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现上述任意一项所述的页面通信方法。When the one or more programs are executed by the one or more processors, the one or more processors implement any one of the foregoing page communication methods.
图9示出的是与本申请实施例提供的计算机设备相关的手机的部分结构的框图。参考图9,手机包括:射频(Radio Frequency,RF)电路210、存储装置220、输入单元230、显示单元240、传感器250、音频电路260、无线保真(wireless fidelity,Wi-Fi)模块270、处理器280、以及电源290等部件。9 is a block diagram of a partial structure of a mobile phone related to a computer device provided by an embodiment of the present application. 9, the mobile phone includes: a radio frequency (Radio Frequency) circuit 210, a storage device 220, an input unit 230, a display unit 240, a sensor 250, an audio circuit 260, a wireless fidelity (Wi-Fi) module 270, The processor 280, the power supply 290 and other components.
RF电路210可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器280处理;另外,将设计上行的数据发送给基站。存储装置220可用于存储软件程序以及模块,处理器280通过运行存储在存储装置220的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。输入单元230可包括触 控面板231以及其他输入设备232。显示单元240可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元240可包括显示面板241。进一步的,触控面板231可覆盖显示面板241。手机还可包括至少一种传感器250。音频电路260、扬声器261,传声器262可提供用户与手机之间的音频接口。Wi-Fi属于短距离无线传输技术,手机通过Wi-Fi模块270可以帮助用户收发电子邮件、浏览网页和访问流式媒体等。处理器280是手机的控制中心,可选的,处理器280可包括一个或多个处理单元。The RF circuit 210 can be used to receive and send signals during receiving and sending information or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 280; in addition, the uplink data designed to be sent to the base station. The storage device 220 may be used to store software programs and modules, and the processor 280 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the storage device 220. The input unit 230 may include a touch panel 231 and other input devices 232. The display unit 240 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 240 may include a display panel 241. Further, the touch panel 231 can cover the display panel 241. The mobile phone may also include at least one sensor 250. The audio circuit 260, the speaker 261, and the microphone 262 may provide an audio interface between the user and the mobile phone. Wi-Fi is a short-distance wireless transmission technology, and the mobile phone can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 270. The processor 280 is a control center of the mobile phone. Optionally, the processor 280 may include one or more processing units.
在一实施方式中,计算机设备包括一个或多个处理器280,以及一个或多个存储装置220,一个或多个应用程序,其中所述一个或多个应用程序被存储在存储装置220中并被配置为由所述一个或多个处理器280执行,所述一个或多个应用程序配置用于执行以上实施例所述的页面通信方法。In an embodiment, the computer device includes one or more processors 280, and one or more storage devices 220, one or more application programs, wherein the one or more application programs are stored in the storage device 220 and It is configured to be executed by the one or more processors 280, and the one or more application programs are configured to execute the page communication method described in the above embodiments.
本申请实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述任意一项所述的页面通信方法。An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, any one of the foregoing page communication methods is implemented.

Claims (10)

  1. 一种页面通信方法,包括:A page communication method, including:
    获取客户端页面发送的第一通信请求;Obtain the first communication request sent by the client page;
    根据所述第一通信请求建立所述客户端页面与服务端页面的通信连接,其中,所述通信连接为所述服务端页面在指定的存储区域内存储状态信息,所述客户端页面监听所述存储区域内的状态信息变化;Establishing a communication connection between the client page and the server page according to the first communication request, wherein the communication connection is for the server page to store state information in a designated storage area, and the client page monitors State information changes in the storage area;
    根据所述通信连接所述客户端页面监听所述服务端页面的状态变化,以使所述客户端页面与所述服务端页面的页面状态同步变化。The client page monitors the status change of the server page according to the communication connection, so that the page status of the client page and the server page changes synchronously.
  2. 根据权利要求1所述的页面通信方法,其特征在于,所述根据所述通信连接所述客户端页面监听所述服务端页面的状态变化,以使所述客户端页面与所述服务端页面的页面状态同步变化包括:The page communication method according to claim 1, wherein the client page monitors the status change of the server page according to the communication connection, so that the client page and the server page The synchronization of page status changes includes:
    获取所述存储区域内的状态信息;Obtaining status information in the storage area;
    将所述状态信息与预设的第一目标状态进行性比对;Compare the state information with a preset first target state;
    当所述状态信息与所述第一目标状态不一致时,确认所述存储区域存储的状态信息发生变化。When the state information is inconsistent with the first target state, it is confirmed that the state information stored in the storage area has changed.
  3. 根据权利要求2所述的页面通信方法,其特征在于,所述当所述状态信息与所述第一目标状态不一致时,确认所述存储区域存储的状态信息发生变化之后,包括:The page communication method according to claim 2, wherein after confirming that the state information stored in the storage area has changed when the state information is inconsistent with the first target state, the method includes:
    获取所述存储区域内的状态变化信息;Acquiring state change information in the storage area;
    根据预设的状态列表识别所述状态变化信息是否为预设的第二目标状态;Identify whether the state change information is a preset second target state according to a preset state list;
    当所述状态变化信息表征的内容与所述第二目标状态的内容一致时,所述客户端页面根据所述状态变化信息调整页面内容。When the content characterized by the state change information is consistent with the content of the second target state, the client page adjusts the page content according to the state change information.
  4. 根据权利要求3所述的页面通信方法,其特征在于,所述当所述状态变化信息表征的内容与所述第二目标状态的内容一致时,所述客户端页面根据所述状态变化信息调整页面内容之后,包括:The page communication method according to claim 3, wherein when the content characterized by the state change information is consistent with the content of the second target state, the client page is adjusted according to the state change information After the page content, including:
    获取所述客户端页面的第一页面截图和所述服务端页面的第二页面截图;Acquiring a first page screenshot of the client page and a second page screenshot of the server page;
    比对所述第一页面截图与所述第二页面截图之间的相似度;Comparing the similarity between the screenshot of the first page and the screenshot of the second page;
    当所述相似度小于预设的第一阈值时,重新对所述客户端页面的页面内容进行调整。When the similarity is less than the preset first threshold, adjust the page content of the client page again.
  5. 根据权利要求4所述的页面通信方法,其特征在于,比对所述第一页面截图与所述第二页面截图之间的相似度包括:The page communication method according to claim 4, wherein comparing the similarity between the first page screenshot and the second page screenshot includes:
    将所述第一页面截图画面与所述第二页面截图画面输入至预设的相似度判断模型中,其中,所述相似度判断模型为预先训练至收敛状态,用于对图片相似度进行判断的神经网络模型;Input the first page screenshot image and the second page screenshot image into a preset similarity judgment model, wherein the similarity judgment model is pre-trained to a converged state for judging the similarity of pictures Neural network model;
    获取所述相似度判断模型输出的分类结果,其中,所述分类结果表征所述第一页面截图与所述第二页面截图之间的相似度。Obtaining a classification result output by the similarity judgment model, wherein the classification result represents the similarity between the first page screenshot and the second page screenshot.
  6. 根据权利要求1所述的页面通信方法,其特征在于,所述根据所述通信连接所述客户端页面监听所述服务端页面的状态变化,以使所述客户端页面与所述服务端页面的页面状态同步变化之后,包括:The page communication method according to claim 1, wherein the client page monitors the status change of the server page according to the communication connection, so that the client page and the server page After the page status changes synchronously, including:
    获取所述客户端页面发送的第二通信请求,其中,所述第二通信请求为跨域通信请求;Acquiring a second communication request sent by the client page, where the second communication request is a cross-domain communication request;
    将所述第二通信请求通过预设的票据页面发送至跨域通信页面建立跨域通信连接,其中,所述票据页面为嵌入所述客户端页面和所述跨域通信页面的内联框架。Sending the second communication request to a cross-domain communication page through a preset bill page to establish a cross-domain communication connection, wherein the bill page is an inline frame embedded in the client page and the cross-domain communication page.
  7. 根据权利要求6所述的页面通信方法,其特征在于,所述将所述第二通信请求通过预设的票据页面发送至跨域通信页面建立跨域通信连接包括:The page communication method according to claim 6, wherein the sending the second communication request to the cross-domain communication page through a preset bill page includes establishing a cross-domain communication connection:
    将所述第二通信请求转化为通信消息,其中,所述通信消息中包括作为通信目标的所述跨域通信页面的通信地址;Converting the second communication request into a communication message, where the communication message includes the communication address of the cross-domain communication page as a communication target;
    根据所述通信地址所述票据页面将所述通信消息转发至所述跨域通信页面,以使所述客户端页面与所述跨域通信页面建立跨域通信连接。Forward the communication message to the cross-domain communication page according to the communication address and the ticket page, so that the client page establishes a cross-domain communication connection with the cross-domain communication page.
  8. 一种页面通信装置,包括:A page communication device, including:
    获取模块,用于获取客户端页面发送的第一通信请求;The obtaining module is used to obtain the first communication request sent by the client page;
    处理模块,用于根据所述第一通信请求建立所述客户端页面与服务端页面的通信连接,其中,所述通信连接为所述服务端页面在指定的存储区域内存储状态信息,所述客户端页面监听所述存储区域内的状态信息变化;A processing module, configured to establish a communication connection between the client page and the server page according to the first communication request, wherein the communication connection is for the server page to store state information in a designated storage area, the The client page monitors the change of state information in the storage area;
    执行模块,用于根据所述通信连接所述客户端页面监听所述服务端页面的状态变化,以使所述客户端页面与所述服务端页面的页面状态同步变化。The execution module is configured to monitor the state change of the server page according to the communication connection, so that the page state of the client page and the server page change synchronously.
  9. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如权利要求1至7中任一项权利要求所述页面通信方法的步骤。A computer device includes a memory and a processor, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor causes the processor to execute any one of claims 1 to 7. A step of the page communication method according to claim.
  10. 一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如权利要求1至7中任一项权利要求所述页面通信方法的步骤。A storage medium storing computer-readable instructions, which when executed by one or more processors, causes the one or more processors to execute as described in any one of claims 1 to 7. Steps of page communication method.
PCT/CN2019/120032 2018-12-29 2019-11-21 Page communication method and apparatus, computer device and storage medium WO2020134754A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811644088.5A CN111385336A (en) 2018-12-29 2018-12-29 Page communication method and device, computer equipment and storage medium
CN201811644088.5 2018-12-29

Publications (1)

Publication Number Publication Date
WO2020134754A1 true WO2020134754A1 (en) 2020-07-02

Family

ID=71126214

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/120032 WO2020134754A1 (en) 2018-12-29 2019-11-21 Page communication method and apparatus, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN111385336A (en)
WO (1) WO2020134754A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666390A (en) * 2022-05-19 2022-06-24 云账户技术(天津)有限公司 Page monitoring method and device of application program, electronic equipment and storage medium
CN115379013A (en) * 2022-06-29 2022-11-22 广州博冠信息科技有限公司 Data processing method and device and electronic equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597408B (en) * 2020-12-28 2023-08-04 恒生电子股份有限公司 System fusion method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615771A (en) * 2015-02-13 2015-05-13 广州华多网络科技有限公司 Webpage data acquiring method and device
US20150350373A1 (en) * 2013-01-15 2015-12-03 Zte Corporation Method for Router to Process Web Page Data, and Router
CN107038017A (en) * 2016-02-03 2017-08-11 博雅网络游戏开发(深圳)有限公司 The method and apparatus that rendering data is obtained
CN107819798A (en) * 2016-09-13 2018-03-20 阿里巴巴集团控股有限公司 Data capture method, Front End Server and data-acquisition system

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100596143C (en) * 2006-03-06 2010-03-24 华为技术有限公司 Method of sharing data in WEB page flow and client apparatus
CN100563264C (en) * 2007-03-15 2009-11-25 华为技术有限公司 Page data transmission method, system and server
CN104461310B (en) * 2013-09-12 2018-01-16 阿里巴巴集团控股有限公司 A kind of page comparison method and system
CN103678549B (en) * 2013-12-04 2017-06-13 新浪网技术(中国)有限公司 Webpage data sharing method and device
CN104301379A (en) * 2014-08-28 2015-01-21 北京奇虎科技有限公司 Web page cross-domain communication method and device
CN104376123B (en) * 2014-12-08 2017-10-17 畅捷通信息技术股份有限公司 The method and apparatus of the cross-page face shared data of browser
CN104504086B (en) * 2014-12-25 2017-11-21 北京国双科技有限公司 The clustering method and device of Webpage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150350373A1 (en) * 2013-01-15 2015-12-03 Zte Corporation Method for Router to Process Web Page Data, and Router
CN104615771A (en) * 2015-02-13 2015-05-13 广州华多网络科技有限公司 Webpage data acquiring method and device
CN107038017A (en) * 2016-02-03 2017-08-11 博雅网络游戏开发(深圳)有限公司 The method and apparatus that rendering data is obtained
CN107819798A (en) * 2016-09-13 2018-03-20 阿里巴巴集团控股有限公司 Data capture method, Front End Server and data-acquisition system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666390A (en) * 2022-05-19 2022-06-24 云账户技术(天津)有限公司 Page monitoring method and device of application program, electronic equipment and storage medium
CN114666390B (en) * 2022-05-19 2022-08-05 云账户技术(天津)有限公司 Page monitoring method and device of application program, electronic equipment and storage medium
CN115379013A (en) * 2022-06-29 2022-11-22 广州博冠信息科技有限公司 Data processing method and device and electronic equipment

Also Published As

Publication number Publication date
CN111385336A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
US10313726B2 (en) Distributing media content via media channels based on associated content being provided over other media channels
US11221822B2 (en) Method and apparatus for controlling page
WO2020134754A1 (en) Page communication method and apparatus, computer device and storage medium
US9559992B2 (en) System and method for updating information in an instant messaging application
US9516259B2 (en) Capturing media content in accordance with a viewer expression
US20170039204A1 (en) Setting expiration of social media posts
JP6800351B2 (en) Methods and devices for detecting burr on electrode sheets
US10467518B1 (en) System and method for generating digital content within an augmented reality environment
CN109961032B (en) Method and apparatus for generating classification model
WO2017101487A1 (en) Method and device for submitting transcoding attribute information
US10628955B2 (en) Information processing device, information processing method, and program for identifying objects in an image
CN110865783A (en) Screen projection method, device, system and storage medium
CN110809189A (en) Video playing method and device, electronic equipment and computer readable medium
US20170163907A1 (en) Method and system for creating a video advertisement with embedded user content
US20170109128A1 (en) Continuous Audio-Clip Streaming with Dynamic Content
WO2021088790A1 (en) Display style adjustment method and apparatus for target device
CN109767257B (en) Advertisement putting method and system based on big data analysis and electronic equipment
US20180249280A1 (en) Method and apparatus for publishing cloud resource
CN111598006A (en) Method and device for labeling objects
US9942473B2 (en) Apparatuses and methods for capture of expected data in visual media
CN107920018B (en) Method, server and system for realizing delayed push of data
KR101744696B1 (en) Method, device, program and recording medium for filtering information
CN110069651B (en) Picture screening method and device and storage medium
CN112148962B (en) Method and device for pushing information
CN108073638B (en) Data diagnosis method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19903367

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19903367

Country of ref document: EP

Kind code of ref document: A1