CN111163128B - Web front-end communication management method based on qWebchannel pipeline in QT - Google Patents

Web front-end communication management method based on qWebchannel pipeline in QT Download PDF

Info

Publication number
CN111163128B
CN111163128B CN201911220680.7A CN201911220680A CN111163128B CN 111163128 B CN111163128 B CN 111163128B CN 201911220680 A CN201911220680 A CN 201911220680A CN 111163128 B CN111163128 B CN 111163128B
Authority
CN
China
Prior art keywords
pipeline
communication
page
web
mode
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.)
Active
Application number
CN201911220680.7A
Other languages
Chinese (zh)
Other versions
CN111163128A (en
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.)
Jiangsu Aijia Household Products Co Ltd
Original Assignee
Jiangsu Aijia Household Products 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 Jiangsu Aijia Household Products Co Ltd filed Critical Jiangsu Aijia Household Products Co Ltd
Priority to CN201911220680.7A priority Critical patent/CN111163128B/en
Publication of CN111163128A publication Critical patent/CN111163128A/en
Application granted granted Critical
Publication of CN111163128B publication Critical patent/CN111163128B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • 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/141Setup of application sessions
    • 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/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a Web front-end communication management method based on a qWebchannel pipeline in QT, which relates to the technical field of multi-end communication in a desktop client program, wherein the communication is carried out in the desktop client program, web front-end engineering interacts with a host program QT or a UE4 platform through a standard method and a channel, and the Web front-end communication management method is characterized in that: the method specifically comprises the following steps: defining pipeline communication, establishing pipeline communication, multiplexing pipeline communication, sharing pipeline communication and appointing a communication mode. Utilizing a page to define communication pipes needed in the page in a route based on a natural mode of a special route, thereby ensuring that the pipe definition is not flooded; and the route guard hook is used again, before the page is entered, the establishment of the pipeline is completed, and then the other life cycles of the page are entered, so that the message is ensured not to be lost. In the process of creating, if the fact that the same pipeline is created on the global object is detected, the same pipeline is not created, and the pipeline reuse rate is improved. If need use the pipeline, pour into can, greatly promote development efficiency.

Description

Web front-end communication management method based on qWebchannel pipeline in QT
Technical Field
The invention relates to the technical field of multi-end communication in a desktop client program, in particular to a Web front-end communication management method based on a qWebChannel pipeline in QT.
Background
With the rapid development of the HTML5 technology, desktop programs developed by C + + and WEB local mixed application development modes are gradually popular based on the characteristics of cross-platform, multi-device, timely updating and the like. And qwebchannel makes up the blank of direct communication between C + + and HTML/JavaScript;
although the desktop application program with a simple C/S architecture has the advantages of stability, quick response, high safety and the like, the desktop application program is difficult to maintain and deploy, and each release requires a user to actively update locally, so that a user group cannot be quickly expanded. And the B/S based on the Web browser just compensates for this disadvantage. With the rapid development of HTML5 and the continuous improvement of compatibility and stability of various large browser manufacturers, a mixed mode based on a C/S architecture and a B/S architecture is more and more popular. That is, in this mode, the Web front-end must communicate with the C + + program. The qwebchannel mode based on QT just fills the blank of communication between two parties. In such communication, in a scenario where both parties communicate frequently, communication interruption and abnormal situations of message loss easily occur, communication management is disturbed, and maintenance is not easy.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a Web front-end communication management method based on a qWebchannel pipeline in QT aiming at the defects of the background technology, so that all communication can be managed better at the Web front end, and the stability and maintainability of the message are improved.
The invention adopts the following technical scheme for solving the technical problems:
web front-end communication management method based on qWebchannel pipeline in QT, wherein communication is carried out at desktop client
In the program, the Web front-end engineering interacts with a host program QT or a UE4 platform through a standard method and a channel, and the method specifically comprises the following steps:
step 1, defining pipeline communication: for defining a unique communication pipe for a page; on the premise that each page is bound to have a unique pipeline name defined and finished in QT and a natural mode of each page based on a front-end route, a specific pipeline identifier agreed with QT is defined for the page by using the extended attribute of the route;
step 2, creating pipeline communication: the method comprises the steps of creating a pipeline which can communicate with a QT for a page; under a front-end development mode based on a VUE frame, acquiring pipeline information of the page by using a global routing guard hook, if the page is detected to have a specific pipeline identifier, creating a pipeline through a qWebChannel module, endowing the pipeline with the specific pipeline identifier of the page, mounting the pipeline on a global object, and entering the page after the creation of the pipeline is completed, so that the pipeline created in the step 1 can be used for communicating with QT in any life cycle instantiated on the page, including before creation, after creation, before mounting, after mounting and the like; if the page is detected to have no specific pipeline identification, the page is directly entered through a callback function next method of the route guard;
step 3, multiplexing pipeline communication: the method is used for multiplexing the pipelines and avoids flooding of the communication pipelines. After each pipeline is created, the pipeline is mounted on a global object through a specific index, namely the specific pipeline identifier in the step 1, when the same page is entered, or when different pages are entered but the pages have the same pipeline identifier, in the process of creating the pipeline in the step 2, if the specific pipeline identifier of the page is detected to exist on the global object, the pipeline is not created any more, and the created pipeline is reused to directly enter the page;
step 4, sharing pipeline communication: a communication pipe for each child component that can share a top level parent component; under a front-end development mode based on a VUE framework, each page is decoupled into subcomponents with independent services and interactive logic; forming parent-child assemblies through nesting of the child assemblies to form a component tree to form a complete page, wherein a route directly enters the topmost parent assembly, and the route is acquired from the parent assembly and shared with the child assemblies through a privide mode, so that the child assemblies can be directly used no matter how many layers the child assemblies are nested, and if the child assemblies need to communicate with QT, the child assemblies can be introduced through an injects injection mode;
step 5, appointing a communication mode: the method is used for the specification of Web communication, QT communication and UE4 communication and the uniform processing of all parties to calling interfaces, and when Web front-end engineering interacts with a host program QT or a UE4 platform through a standard method and a standard channel, the main communication directions are as follows: web to QT, web to UE4, QT to Web, UE4 to Web, each communication direction agrees with the initiator, the callee method, the method to participate in.
As the Web front-end communication management method based on the qWebChannel pipeline in QT, the communication mode specifically comprises the following four communication modes:
the communication mode 1 is that the Web is initiated, directly communicates with the QT and executes a function in the QT;
the communication mode 2 is that QT is initiated, directly communicates with Web, and executes the method in the Web front end;
a communication mode 3 is initiated by Web, and the UE4 method is executed through communication between the QT and the UE 4;
and the communication mode 4 is that the UE4 initiates, communicates with the Web through the QT and executes the Web method, the UE4 transmits the message to the QT through a socket pipeline, and executes the Web end method through the QT.
In Web communication, QT communication and UE4 communication, the UE4 can distribute each communication to a specific appointed method only by uniformly processing communication interfaces, the QT can distribute and transfer each Web to the communication of the UE4 or the communication of the UE4 to the Web only by defining a uniform communication protocol for each pipeline, and the Web can be used as required by the Web end.
Compared with the prior art, the invention adopting the technical scheme has the following technical effects:
1. utilizing a page to define communication pipes needed in the page in a route based on a natural mode of a special route, thereby ensuring that the pipe definition is not flooded;
2. and the route guard hook is used again, before the message enters the page, the message enters other life cycles of the page after the pipeline is established, so that the message is ensured not to be lost. In the process of creating, if the fact that the same pipeline is created on the global object is detected, the same pipeline is not created, and the pipeline reuse rate is improved. If need use the pipeline, pour into can, greatly promote development efficiency.
Drawings
FIG. 1 is a schematic diagram of a multi-port architecture, languages of each port, and communication channels therebetween involved in a first embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a Web front-end definition pipeline according to a second embodiment of the present invention;
FIG. 3 is a flowchart illustrating a Web front-end pipeline creation process in a second embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a Web front-end shared pipeline in the second embodiment of the present invention;
fig. 5 is a schematic structural diagram of 4 communication methods involved in the third embodiment of the present invention.
Detailed Description
The technical scheme of the invention is further explained in detail by combining the drawings as follows:
the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
Example one
Referring to fig. 1, the terminals involved in the present invention are:
1. host program QT (C + + language)
2. UE4 program (C + + language) based on illusion engine
3. VUE-based Web front end (JavaScript language)
Referring to fig. 1, the communication conduit of the present invention involves:
the Web front end and the QT are communicated based on a qWebchannel pipeline;
the Web front end communicates with ue4 through QT;
QT communicates with the socket of UE 4;
example two
The invention mainly manages all communications at the Web front end better under the scene based on the communication modes, and improves the stability and maintainability of the messages.
A Web front-end communication management method based on a qWebchannel pipeline in QT specifically comprises the following steps:
step 1, defining pipeline communication: referring to fig. 2, a unique communication pipe is defined for a page. On the premise that each page is bound to have a unique pipeline name defined and finished in QT and a natural mode of each page based on a front-end route, a specific pipeline identifier agreed with QT is defined for the page by using an extended meta attribute of the route;
step 2, creating pipeline communication: referring to FIG. 3, a pipeline is created for the page that can communicate with the QT. Under a front-end development mode based on a VUE frame, acquiring pipeline information of the page by using a global routing guard hook, if the page is detected to have a specific pipeline identifier, creating a pipeline through a qWebChannel module, endowing the pipeline with the specific pipeline identifier of the page, mounting the pipeline on a global object, and entering the page after the creation of the pipeline is completed, so that the pipeline created in the step 1 can be used for communicating with QT in any life cycle instantiated on the page, including before creation, after creation, before mounting, after mounting and the like; if the page is detected to have no specific pipeline identification, the page is directly entered through a callback function next method of the route guard;
step 3, multiplexing pipeline communication: referring to fig. 3, the method is used for multiplexing the pipeline and avoiding flooding of the communication pipeline. After each pipeline is created, the pipeline is mounted on a global object through a specific index, namely the specific pipeline identifier in the step 1, when the same page is entered, or when different pages are entered but the pages with the same pipeline identifier are provided, in the process of creating the pipeline in the step 2, if the specific pipeline identifier of the page is detected to exist on the global object, the pipeline is not created any more, the created pipeline is reused, and the page is directly entered;
step 4, sharing pipeline communication: referring to fig. 4, in the VUE framework based front-end development mode, each page is decoupled into subcomponents with independent service interaction logic; forming a parent sub-component to form a component tree to form a complete page through nesting of the sub-components; one route directly enters the top-level parent component, the pipeline created in the process of step 2 is acquired from the parent component, and is shared to the sub-components through the privide mode, and no matter how many layers of sub-components are nested, if communication with the QT is needed, the sub-components can be directly used only by introducing the injection mode through the objects;
step 5, appointing a communication mode: the specification of the communication of three parties (Web, QT, UE 4) of a user and the unified processing of the calling interface by each party. When the Web front-end engineering interacts with a host program QT or a UE4 platform through a standard method and a standard channel, the main communication directions are as follows: web to QT, web to UE4, QT to Web, UE4 to Web. Each communication direction agrees with the initiator, the callee, the method to be called, and the method entry.
EXAMPLE III
The specific communication mode is as follows:
communication method 1: web initiates, directly communicates with QT, carries out function in QT: channel.doqtsomething (param) if it needs to be returned, it passes through channel.doqtsomething (param, resultCallback). Wherein channel is a pipeline, doQTSometalling is a QT middle function, param is a parameter, and resultCallback is a web middle callback function.
Communication method 2: QT initiates, directly communicates with the Web, and executes a method in the Web front end
runJavaScript ("doWebSometaling (param)"). If it needs to be returned, the process is carried out
runJavaScript ("doWebSometing (param)", resultCallback); the runJavaScript is a method in QT, the execution environment of the runJavaScript is a pipeline where the current page is located, doWebSometalling is a method for mounting a web end into a global object, param is a parameter, and resultCallback is a QT callback function.
Communication method 3: the Web initiates, communicating with the UE4 over QT, performing the UE4 method. call UE4function (param), if callback is required, UE4 needs to initiate communication to the Web once (see communication mode 4). Wherein channel is a pipeline, callUE4function is a QT method, and param is a parameter. In this type of communication, param parameters require a Web end and a UE4 end, and the definition specification is shown in table 1:
TABLE 1
Field(s) Table meaning Description of the invention
Module UE4 Module name Provided by the UE4 and is a specific functional module in the UE4 code
Function UE4 method name Provided by the UE4, as a specific method in the UE4 code
InputParams Method parameter Incorporation by execution of the method defined by Funciton
Then, in the callUE4function of QT, param parameter information is transmitted to the UE4 end through a socket pipeline. The UE4 end receives the param parameter information in a unified mode, and distributes the param parameter information to specific Function bands to be executed according to the Module and the Function fields.
Communication mode 4: the UE4 initiates, communicates with the Web through the QT, and executes the Web method. UE4 transmits the message to QT through the socket pipeline, and executes the Web end method through QT. The message field definition specification is shown in table 2:
TABLE 2
Field(s) Table meaning Description of the preferred embodiment
Type The message type A value of 1 indicates that the Web-end method needs to be executed
Function Web end method name Method provided by Web end and used for mounting Web end to global object
InputParams Method parameter Incorporation by execution of the method defined by Funciton
When the QT listens for such messages (Type = 1), it will process uniformly to execute the Function in the Web by using the InputParams as described in communication means 2.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The above embodiments are only for illustrating the technical idea of the present invention, and the technical idea of the present invention is not limited thereto, and any modifications made on the basis of the technical solution according to the technical idea of the present invention fall within the protective scope of the present invention. While the embodiments of the present invention have been described in detail, the present invention is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present invention within the knowledge of those skilled in the art.

Claims (2)

1. The utility model provides a Web front end communication management method based on qWebchannel pipeline in QT, communication in desktop client program, web front end engineering is through standard method and passageway and host program QT or UE4 platform to carry out the interaction, its characterized in that: the method specifically comprises the following steps:
step 1, defining pipeline communication: for defining a unique communication pipe for a page; on the premise that each page is bound to have a unique pipeline name defined and finished in QT and a natural mode of each page based on a front-end route, a specific pipeline identifier agreed with QT is defined for the page by using the extended attribute of the route;
step 2, creating pipeline communication: the method comprises the steps of creating a pipeline which can communicate with a QT for a page; acquiring the pipeline information of the page by using a global routing guard hook in a front-end development mode based on a VUE (virtual operating environment) frame, if the page is detected to have a specific pipeline identifier, creating a pipeline through a qWebChannel module, endowing the pipeline with the specific pipeline identifier of the page and mounting the pipeline to a global object, and entering the page after the pipeline is created, so as to ensure that the pipeline created in the step 1 can be used for communicating with QT in any life cycle instantiated by the page, including before creation, after creation, before mounting and after mounting; if the page is detected to have no specific pipeline identification, directly entering the page through a callback function next method of a route guard;
step 3, multiplexing pipeline communication: the system is used for multiplexing the pipelines, and avoids flooding of the communication pipelines;
after each pipeline is created, the pipeline is mounted on a global object through a specific index, namely the specific pipeline identifier in the step 1, when the same page is entered, or when different pages are entered but the pages have the same pipeline identifier, in the process of creating the pipeline in the step 2, if the specific pipeline identifier of the page is detected to be already present on the global object, the pipeline is not created any more, and the created pipeline is reused to directly enter the page;
step 4, sharing pipeline communication: a communication pipe for each child component that can share a top level parent component; under a front-end development mode based on a VUE framework, each page is decoupled into subcomponents with independent services and interactive logic; forming parent-child assemblies through nesting of the child assemblies to form a component tree to form a complete page, wherein a route directly enters the topmost parent assembly, and the route is acquired from the parent assembly and shared with the child assemblies through a privide mode, so that the child assemblies can be directly used no matter how many layers the child assemblies are nested, and if the child assemblies need to communicate with QT, the child assemblies can be introduced through an injects injection mode;
step 5, appointing a communication mode: the method is used for the specification of Web communication, QT communication and UE4 communication and the uniform processing of all parties to calling interfaces, and when Web front-end engineering interacts with a host program QT or a UE4 platform through a standard method and a standard channel, the main communication directions are as follows: web to QT, web to UE4, QT to Web, UE4 to Web, each communication direction agrees with the initiator, the callee method, and the method to be referred to.
2. The method for managing Web front-end communication based on qWebChannel pipeline in QT of claim 1, which is characterized in that: the communication method specifically includes the following four communication methods:
the communication mode 1 is that the Web is initiated, directly communicates with the QT and executes a function in the QT;
the communication mode 2 is that QT is initiated, directly communicates with Web, and executes the method in the Web front end;
the communication mode 3 is Web initiation, and the Web is communicated with the UE4 through QT to execute the UE4 method;
and 4, a communication mode is adopted, wherein UE4 initiates communication with the Web through the QT to execute the Web method, UE4 transmits the message to the QT through a socket pipeline, and the Web end method is executed through the QT.
CN201911220680.7A 2019-12-03 2019-12-03 Web front-end communication management method based on qWebchannel pipeline in QT Active CN111163128B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911220680.7A CN111163128B (en) 2019-12-03 2019-12-03 Web front-end communication management method based on qWebchannel pipeline in QT

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911220680.7A CN111163128B (en) 2019-12-03 2019-12-03 Web front-end communication management method based on qWebchannel pipeline in QT

Publications (2)

Publication Number Publication Date
CN111163128A CN111163128A (en) 2020-05-15
CN111163128B true CN111163128B (en) 2022-12-16

Family

ID=70556332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911220680.7A Active CN111163128B (en) 2019-12-03 2019-12-03 Web front-end communication management method based on qWebchannel pipeline in QT

Country Status (1)

Country Link
CN (1) CN111163128B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527430A (en) * 2020-12-03 2021-03-19 万翼科技有限公司 Data deployment method and related device
CN113553205B (en) * 2021-09-17 2021-12-07 统信软件技术有限公司 Execution method and executor for QT and Web end communication protocols

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102681846A (en) * 2012-04-26 2012-09-19 中山大学 Embedded multimedia playing system and method
US9116706B2 (en) * 2012-10-09 2015-08-25 Tamer Yunten Yunten's web application methodology and web programming language (YWAM and WPL)
KR102238534B1 (en) * 2014-02-26 2021-04-09 엘지전자 주식회사 Digital device and method of processing a screen saver thereof

Also Published As

Publication number Publication date
CN111163128A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
CN106850788B (en) Integrated framework and integrated approach towards multi-source heterogeneous geographic information resources
CN111163128B (en) Web front-end communication management method based on qWebchannel pipeline in QT
CN102169500B (en) Dynamic service flow display method and device
CN102904738B (en) Work order processing method, relevant device and relevant system
CN104268025A (en) Interprocess communication method and system, and server
CN105227364A (en) A kind of method of ERP system resource-sharing and device
CN104915242A (en) Multidisciplinary co-simulation architectural method
CN103457761A (en) Cross-platform command line configuration interface implementation method
CN105007304A (en) SOA-based enterprise information technology system data exchange and integration system
CN110868449B (en) Method and system for realizing timing task based on asynchronous message
EP2480013A1 (en) Method and system for realizing application of machine-to-machine/man terminal based on groups
CN104811479B (en) A kind of creation method based on forwarding with the virtual network node of control separated protocol
CN109683875B (en) Application framework system of MVC (model view controller) pattern in distributed environment and method thereof
WO2021003843A1 (en) Method for hierarchical and distributed coordinated control of time sequence for integrated energy system in industrial complex
CN105407031A (en) Method and system for building instant communication based on members in same group
CN107333332B (en) Method for distributing access type communication service resource by using prefabricated rule
CN109284935A (en) A kind of task processing system based on micro- assistance the superior and the subordinate office group
CN103534751B (en) voice synchronous method and device
CN103092620B (en) A kind of Microsoft Exchange Server 2010 Web service integrated development method
CN101859249B (en) Method, device and system for realizing automatic flow with manual tasks
CN114501595B (en) 5G networking engineering management system
CN109447517A (en) A kind of marine traffic engineering construction ship management system
KR101109091B1 (en) Distributed transaction method for data having hybrid structure
CN110493274A (en) A technique for basis link is done for wisdom (city) engineering
CN103207798A (en) Method of automatic system installation in distributed environment

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
GR01 Patent grant
GR01 Patent grant