WO2021103644A1 - Data structure, communication method and apparatus, storage medium and device - Google Patents

Data structure, communication method and apparatus, storage medium and device Download PDF

Info

Publication number
WO2021103644A1
WO2021103644A1 PCT/CN2020/107463 CN2020107463W WO2021103644A1 WO 2021103644 A1 WO2021103644 A1 WO 2021103644A1 CN 2020107463 W CN2020107463 W CN 2020107463W WO 2021103644 A1 WO2021103644 A1 WO 2021103644A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
client
web page
communication interface
call
Prior art date
Application number
PCT/CN2020/107463
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 WO2021103644A1 publication Critical patent/WO2021103644A1/en

Links

Images

Classifications

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

Definitions

  • the present disclosure relates to the field of computer technology, for example, to data structures, communication methods, devices, storage media, and equipment.
  • the web side also known as the front-end
  • the client is two different software systems, and there will be more problems in the communication process between the two.
  • the client declares the calling method list to the web page through javascript (js) injection, and realizes communication with the web page.
  • problems such as the complexity of the communication between the two ends and the inability to track the call path will occur. .
  • the present disclosure provides data structures, communication methods, devices, storage media, and equipment, which can optimize the communication scheme between the client and the embedded webpage.
  • a data structure is provided for message transfer between a client and a web page, the web page is embedded in the client and interacts with a local layer, and the data structure includes:
  • the method identifier is used to indicate the unique identifier corresponding to this invocation of the method invoking, and the method identifier is consistent in the message used to request the invocation and the message used to feedback the invocation result;
  • the call parameter is used to indicate the parameter corresponding to this call of the call method.
  • the data structure in a case where the data structure exists in a message for feeding back the call result, the data structure further includes the call result.
  • a communication method which communicates based on the data structure provided in the present disclosure, including:
  • the method identifier included in a message constructs a second message, and returns the second message to the web page through a second communication interface, wherein the first processing result is included in the calling result in the second message .
  • a communication device which performs communication based on the data structure provided in the present disclosure, including:
  • a call initiation module configured to control the web page to send a first message for invoking the first method to the client through the first communication interface after detecting that the web page is started in the client;
  • Call the feedback module set to control the client to receive the first message by listening to the first communication interface, and perform corresponding processing on the first message to obtain a first processing result, according to the first
  • the processing result and the method identifier included in the first message construct a second message, and the second message is returned to the web page through a second communication interface, wherein the first processing result is included in the second In the call result in the message.
  • a computer-readable storage medium which stores a computer program, and when the computer program is executed by a processor, the communication method as provided in the embodiment of the present invention is realized.
  • An intelligent terminal device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor implements the communication method as provided in the embodiment of the present invention when the processor executes the computer program. .
  • FIG. 1 is a schematic flowchart of a communication method according to Embodiment 2 of the present invention.
  • FIG. 2 is a schematic flowchart of a communication method according to Embodiment 3 of the present invention.
  • Embodiment 4 of the present invention is a schematic flowchart of a communication method provided by Embodiment 4 of the present invention.
  • FIG. 4 is a schematic flowchart of a communication method according to Embodiment 5 of the present invention.
  • FIG. 5 is a schematic flowchart of a method registration provided by Embodiment 5 of the present invention.
  • Embodiment 6 is a structural block diagram of a communication device provided by Embodiment 6 of the present invention.
  • FIG. 7 is a structural block diagram of an intelligent terminal device provided by Embodiment 8 of the present invention.
  • the embodiment of the present invention provides a data structure, which is applied to message transfer between a client and a web page.
  • the web page is embedded in the client and interacts with the local layer.
  • the data structure includes a calling method and a method. Identification and call parameters, where, when the data structure exists in a message used to feed back the call result, the data structure also includes the call result.
  • the calling method is used to indicate the method requested to be called; the method identifier is used to indicate the unique identifier corresponding to this invocation of the calling method, and the method identifier is used in the message for requesting the calling and used for feedback.
  • the message of the calling result is consistent; the calling parameter is used to indicate the parameter corresponding to the current calling of the calling method.
  • the client can be understood as an application program installed in a smart terminal device.
  • the smart terminal device may include devices capable of loading operating systems such as smart phones, tablet computers, notebook computers, computers, and smart home appliances.
  • the embodiment of the present invention does not limit the type of operating system loaded in the smart terminal device.
  • it may be an Android operating system, a Windows operating system, an iPhone Operation System (IOS) operating system, and so on.
  • the client can be referred to as a mobile client.
  • the web page can also be referred to as a web or front end, and can include, for example, a web page or a web component.
  • the web component can include, for example, an embedded web component such as a lottery box that appears in the form of a floating window in the client.
  • the native layer is the Native layer, which can provide methods related to system applications such as phones, information, and cameras, as well as methods related to other applications in the mobile terminal.
  • the web page can interact with the client to perform the methods provided by the Native layer. transfer.
  • the web page can implement multiple functions by calling methods to the client, such as obtaining information, including obtaining user tokens, etc.; such as using client application (Application, App) related features, including changing the structure of the form, sharing functions, and taking pictures Functions and in-app jumps and so on.
  • client application Application, App
  • the client declares the calling method list to the web page through js injection, and realizes communication with the web page.
  • problems such as complicated communication between the two ends and the inability to track the call path may occur.
  • the web page initiates two calls to the client, which are recorded as a call and b call.
  • the two calls can be calls to the same method or calls to two methods respectively.
  • After the client receives the call from the web page The corresponding processing will be performed and the processing result will be fed back. Two different processing results will be fed back for the two calls, which are recorded as result a and result b respectively.
  • the two calls are performed asynchronously, the processing time is different. Therefore, the web page cannot confirm which call the received result a and result b correspond to according to the time sequence, and confusion will occur.
  • a data structure is provided, and a message for communication can be constructed between the client and the web page based on the data structure.
  • the data structure not only contains the method to be called and the corresponding parameters, but also contains the unique identifier corresponding to the current call for the method to be called, which is called the method identifier.
  • the method identifier is consistent in the message used to request the call and the corresponding message used to feedback the call result. In this way, both parties in communication can track the call path through the method identifier.
  • the method identification can be set by the caller.
  • the webpage when the webpage initiates a call to the client, the webpage can set the method identification for this call in the message used to request the call, and the client can Extract the method identifier from the received message and add it to the message used to feed back the call result, and feed it back to the web page.
  • the call result may include error code, error information, and parameter information. If the call is successful, the error code and error message can be blank or 0 by default. If an exception occurs in this call, the error code and error message can be used in the call result to indicate the type and cause of the exception.
  • the parameter information may include the processing result information of the caller for this call.
  • the data structure in the embodiment of the present invention may also include a service type.
  • the advantage of this setting is that the methods involved can be classified according to the characteristics of different services, so that the callee can quickly find the corresponding method and the execution object corresponding to the method according to the service type.
  • the data structure also includes a service type, and the service type is used to indicate the service type corresponding to the calling method.
  • the message sent by the web page to the client can be recorded as ClientAciton (client behavior), and the message feedback from the client to the web page can be recorded as WebAciton ( Web-side behavior).
  • ClientAciton can contain the following data structure:
  • WebAciton can contain the following data structures:
  • the data structure provided in the embodiment of the present invention is applied to the message transfer between the client and the webpage embedded in the client, so as to realize the interaction between the webpage and the local layer. Because in the message transfer process, the data structure contains The unique identifier of the method that needs to be called for this call. Therefore, the client and the web page can track the call path of the entire call process based on the unique identifier, thus standardizing the communication between the client and the web page, and effectively Avoid the problem of communication confusion.
  • FIG. 1 is a schematic flowchart of a communication method according to Embodiment 2 of the present invention.
  • the method can be executed by a communication device, where the device can be implemented by software and/or hardware, and can be integrated in a smart terminal device. As shown in Fig. 1, the method includes: step 101 to step 102.
  • Step 101 After detecting that the webpage terminal is started in the client terminal, control the webpage terminal to send a first message for invoking the first method to the client terminal through the first communication interface.
  • the first message can be constructed according to the data structure provided in the embodiment of the present invention and sent to the client.
  • the calling method in the first message is the first method, which can be the name or code of the first method, etc.
  • the method identifier is the unique identifier set by the web page for this call, and the calling parameter is the current call of the first method. Call the corresponding parameters.
  • the first communication interface may be implemented through a js method, and the webpage terminal may transmit the first message to the client through the js method.
  • the first communication interface may be called executeActionInClient.
  • Step 102 The control client receives the first message by monitoring the first communication interface, and performs corresponding processing on the first message to obtain the first processing result, and constructs the first processing result according to the first processing result and the method identifier contained in the first message. Second message, the second message is returned to the web page through the second communication interface.
  • the first processing result is included in the calling result in the second message.
  • the client receives the first message delivered by the web page by monitoring the first communication interface, and confirms the requirements of this call by extracting the content of the data structure in the first message, and then performs the corresponding Processing to obtain the first processing result. Subsequently, a second message is constructed according to the method identifier extracted from the first message together with the first processing result, and fed back to the web page through the second communication interface to realize the result callback. The first processing result is included in the call result of the second message in.
  • the second communication interface may be implemented by a js method, and the client may use the js method to call back the execution result to the front end.
  • the second communication interface may be called callbackInWeb.
  • js files for supporting calling can be pre-written on the web page, such as base.js, these files need to implement the methods of the first communication interface and the second communication interface, and standardize the message production method in the calling process.
  • the corresponding processing for the first message includes: notifying the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and executing the target execution object
  • the result is determined as the first processing result.
  • WKWebView of the iOS client as an example, obtain the first message passed by the first communication interface executeActionInClient, and design WKWebViewJSDispatcher to forward the first message, such as forwarding a message of type AppBase to AppBaseModel (target execution object) for processing .
  • AppBaseModel When AppBaseModel receives the message, it makes corresponding processing actions, and takes out the identifier in the incoming first message as the identifier of the return parameter, and passes the second message to the web page through the second communication interface callbackInWeb to indicate the call path.
  • the communication method provided in the embodiment of the present invention is applied to the message transmission between the client and the webpage embedded in the client.
  • the webpage After detecting that the webpage is started in the client, the webpage is controlled to communicate to the client through the first communication interface.
  • the client sends the first message for invoking the first method.
  • the client receives the first message by monitoring the first communication interface, it performs corresponding processing on the first message to obtain the first processing result, and according to the first processing result and
  • the method identifier contained in the first message constructs the second message, and returns the second message to the web page through the second communication interface. Because in the message transmission process, both the first message and the second message contain the first message that needs to be called.
  • the method is a unique identifier for this call. Therefore, the client and web page can track the call path of the entire call process based on the unique identifier, thereby standardizing the communication between the client and the web page, effectively avoiding communication confusion The problem.
  • the method further includes: if it is determined that the local layer does not allow the calling of the first method, then A third message is constructed according to the method identifier included in the first message, the third message is returned to the web page through the second communication interface, and the calling result in the third message contains error information.
  • the methods supported by the local layer may be different.
  • the method to be called by the web page may not exist. Therefore, the local layer cannot support it. Calling is equivalent to not allowing calls.
  • the web page can immediately know that the current client does not support the corresponding method, and no wrong follow-up activities will be generated.
  • the call result contains a 404 error code and an error message msg (such as a related error prompt). After receiving the third message, the web page can perform corresponding processing according to its own strategy.
  • Fig. 2 is a schematic flowchart of a communication method provided in the third embodiment of the present invention. On the basis of the above-mentioned embodiment, relevant content of interface registration is added.
  • the method further includes: controlling the client terminal to register the first communication interface and the second communication interface with the webpage terminal.
  • controlling the client to register the first communication interface and the second communication interface with the web page includes: obtaining the identity of the current web page of the web page; and according to the identity Identify and query preset authorization information, and if the current web page is determined to be in an authorized state according to the query result, control the client to register the first communication interface and the second communication interface with the web page.
  • the method may include: step 201 to step 209.
  • Step 201 It is detected that the web page is started in the client.
  • Step 202 Obtain the identity of the current webpage on the webpage side, and query preset authorization information according to the identity.
  • authorization information may be set in advance, and the authorization information may include the identity of the webpage that allows the communication method of the embodiment of the present invention to communicate with the client.
  • the identity may be, for example, It is a Uniform Resource Locator (URL).
  • the preset authorization information is maintained on the client, so as to determine whether to allow the call of the current webpage according to the latest preset authorization information.
  • Step 203 Determine whether the current webpage is in an authorized state according to the query result, if yes, go to step 204; otherwise, end the process.
  • Step 204 Control the client to register the first communication interface and the second communication interface with the web page.
  • the current webpage can be allowed to communicate with the client.
  • the first communication interface and the second communication interface can be realized by the js method, and the registration of the first communication interface and the second communication interface can be realized by registering the corresponding js method to the web page.
  • the first communication interface and the second communication interface can be registered in the information processing handle on the web page.
  • the information processing handle can be ScriptMessageHandler, and in other operating systems, other names can be used to implement message processing.
  • the object of the handle function can be ScriptMessageHandler, and in other operating systems, other names can be used to implement message processing.
  • Step 205 Control the web terminal to send a first message for invoking the first method to the client through the first communication interface.
  • Step 206 The control client receives the first message by monitoring the first communication interface.
  • Step 207 The control client determines whether the first method is allowed to be called by the local layer, and if so, execute step 208; otherwise, execute step 209.
  • Step 208 The control client notifies the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and determines the execution result of the target execution object as the first processing result, and according to the first processing result and the first message contains The method identifier constructs a second message, and returns the second message to the web page through the second communication interface.
  • Step 209 The control client constructs a third message according to the method identifier contained in the first message, and returns the third message to the web page through the second communication interface, and the call result in the third message contains error information.
  • the communication method after detecting that the web page is started in the client, obtains the identity of the current web page of the web page, and queries preset authorization information according to the identity to determine whether the local layer allows the current web page to communicate, If allowed, register the first communication interface and the second communication interface with the web page to establish a communication channel between the client and the web page. Then, the web page can send the first message for invoking the first method through the first communication interface, After receiving the first message, the client informs the target execution object to process, and constructs a second message based on the processing result and the method identifier in the first message to feed back to the web page, so that the web page can track the calling path. When the call is allowed, the third message containing the error information is fed back to the web page to let the web page know that the call failed in time and prevent subsequent activities that cause errors.
  • Fig. 3 is a schematic flow chart of a communication method provided by the fourth embodiment of the present invention.
  • the relevant steps of the method of controlling the client to register the local layer with the webpage to allow the current webpage of the webpage to be called are added.
  • the method further includes: controlling the client to register a local layer with the web page to allow the current web page of the web page to perform Called method, get the first method list.
  • This setting is that it can notify the web page to call the method in advance, effectively reducing the probability of unexpected calls.
  • controlling the web page to send a first message for invoking the first method to the client via a first communication interface includes: controlling the web page to query the list of the first methods Whether the first method that needs to be called currently is included, if included, construct a first message for invoking the first method, and send the first message to the client through the first communication interface.
  • the advantage of this setting is that before initiating the call, the web page can first determine whether the client allows the call of the currently required method by querying the first method list, and if allowed, construct the first message to avoid subsequent useless operations.
  • the method may include: step 301 to step 309.
  • Step 301 It is detected that the web page is started in the client.
  • Step 302 Obtain the identity of the current webpage on the webpage side, and query preset authorization information according to the identity.
  • Step 303 Determine whether the current webpage is in an authorized state according to the query result, if yes, go to step 304; otherwise, end the process.
  • Step 304 Control the client to register the first communication interface and the second communication interface with the web page.
  • Step 305 Control the client to register with the web page the method that the local layer allows the current web page of the web page to call, and obtain the first method list.
  • the first preset registration method such as regMethod
  • the first preset registration method can be used to register a method that the local layer allows the current web page of the web page to call to the message processing handle of the web page, such as ScriptMessageHandler.
  • Step 306 Control the web page to query whether the first method list includes the first method that needs to be called, and if it does, execute step 307; otherwise, end the process.
  • Step 307 Control the web terminal to construct a first message for invoking the first method, and send the first message to the client through the first communication interface.
  • Step 308 The control client receives the first message by monitoring the first communication interface.
  • Step 309 The control client informs the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and determines the execution result of the target execution object as the first processing result, according to the first processing result and the first message containing The method identifier constructs a second message, and returns the second message to the web page through the second communication interface.
  • the target execution object corresponding to the first method before the target execution object corresponding to the first method is notified to perform the corresponding operation according to the first message, it can also be judged whether the local layer is allowed to call the first method. If allowed, perform this step again. If not allowed , The third message can be constructed according to the method identifier contained in the first message, and the third message is returned to the web page through the second communication interface, and the call result in the third message contains error information.
  • the advantage of this setting is that although the web page has been queried according to the first method list, there may still be errors in the first method list or other bugs. Therefore, the fault tolerance of this solution can be enhanced.
  • the client after detecting that the webpage is started in the client, after registering the first communication interface, the client is also controlled to register the first method list with the webpage, and the webpage is notified in advance that the method can be called, In this way, before initiating the call, the web page can first determine whether the client allows the call of the currently required method by querying the first method list. If allowed, construct the first message to avoid subsequent useless operations and effectively reduce the unexpected Probability of calling.
  • Fig. 4 is a schematic flow chart of a communication method provided by the fifth embodiment of the present invention. On the basis of the above-mentioned embodiment, relevant content of the method for the client to call the webpage is added.
  • the method further includes: controlling the client terminal to send a fourth message for invoking the second method to the webpage terminal through a third communication interface;
  • the web page receives the fourth message by monitoring the third communication interface, and performs corresponding processing on the fourth message to obtain a second processing result, according to the second processing result and the fourth message
  • the method identifier included in the fifth message constructs a fifth message, and the fifth message is returned to the client through a fourth communication interface, wherein the second processing result is included in the calling result in the fifth message.
  • the method further includes: controlling the web page to construct a sixth message, and to send a message to the web through the first communication interface.
  • the client sends the sixth message to realize the method for registering the current page of the web page with the client to support the client invocation, wherein the invocation method in the sixth message is the local layer
  • the call parameter in the sixth message includes a method that the current page of the web page supports the client to call; and the client is controlled to generate a second method list according to the sixth message.
  • controlling the client to send a fourth message for invoking the second method to the web page by invoking a third communication interface includes: controlling the client to query the second method list Whether it contains the second method that needs to be called currently, if it contains, construct a fourth message for invoking the second method, and send the fourth message to the web page through a third communication interface.
  • the advantage of this setting is that before initiating the call, the client can first determine whether the web page allows the call of the currently required method by querying the second method list, and if allowed, construct a second message to avoid subsequent useless operations.
  • the method may include: step 401 to step 409.
  • Step 401 It is detected that the web page is started in the client.
  • the client When it is detected that the webpage is started in the client, the client can be controlled to register the first communication interface and the second communication interface with the webpage, and the client can be controlled to register the third communication interface and the fourth communication interface with the webpage. All of the above four communication interfaces can be implemented by using the js method.
  • the first communication interface may be called executeActionInClient
  • the second communication interface may be called callbackInWeb
  • the third communication interface may be called executeActionInWeb
  • the fourth communication interface may be called callbackInClient.
  • the third communication interface can be multiplexed with the first communication interface
  • the fourth communication interface can also be multiplexed with the second communication interface. In this way, when it is detected that the web page is started in the client, the client is controlled to the web page. Just register the first communication interface and the second communication interface.
  • Step 402 Control the client to register with the web page the method that the local layer allows the current web page of the web page to call, and obtain the first method list.
  • the first preset registration method such as regMethod
  • the first preset registration method can be used to register a method that the local layer allows the current web page of the web page to call to the message processing handle of the web page, such as ScriptMessageHandler.
  • Step 403 Control the webpage to construct a sixth message, and send the sixth message to the client through the first communication interface, so as to realize the method of registering the current page of the webpage with the client to support client invocation.
  • the calling method in the sixth message is a registration method provided by the local layer, and the calling parameter in the sixth message includes a method that the current page of the web page supports the client to call.
  • the data structure in the sixth message can contain the following content:
  • Step 404 The control client generates a second method list according to the sixth message.
  • the URL of the current webpage can be used as the key
  • the MethodList can be used as the value (value) to construct a page application programming interface (Application Programming Interface, API) support table of the Map structure, that is, the above-mentioned section 2. List of methods.
  • FIG. 5 is a schematic diagram of a method registration process provided by Embodiment 5 of the present invention.
  • the client can use the regMethod method to register the local layer in the ScriptMessageHandler to allow the current web page of the web page to be called.
  • Web You can query the first method list, and initiate a call to the client through executeActionInClient, and the client feeds back the call result through the js method.
  • the web page can register with the client the methods that the current web page allows the client to call by calling the local layer regMethodForUrl method to form a second method list regMethodList.
  • the client can query the second method list and initiate a call to the web page through executeActionInWeb.
  • the result of the call is fed back through the js method.
  • the third communication interface can be reused, that is, the call result feedback can be performed through callbackInWeb.
  • the web page can construct the sixth message after the base.js file described above is loaded, and call executeActionInClient to register with the client, and then intercept the message passed in executeActionInWeb for the api list listed in regMethodForUrl Realize monitoring.
  • Step 405 The control webpage determines the first method that needs to be called currently, and if the first method is found in the first method list, the control webpage constructs a first message for invoking the first method, and passes the first communication interface Send the first message to the client.
  • step 407 to step 409 may be before step 405 and step 406 carried out.
  • the data structure in the first message can contain the following content:
  • Step 406 Control the client to receive the first message by listening to the first communication interface, notify the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and determine the execution result of the target execution object as the first processing result , Construct a second message according to the first processing result and the method identifier contained in the first message, and return the second message to the web page through the second communication interface.
  • the first processing result is included in the calling result in the second message.
  • Step 407 Control the client to query whether the second method list currently needs to be called is included in the second method list, and if it does, construct a fourth message for invoking the second method, and send it to the web page through the third communication interface Fourth news.
  • Step 408 The control client sends a fourth message for invoking the second method to the web page through the third communication interface.
  • the identity of the current page after the jump can be taken out, and the identity of the current page and the identity in the second method list can be checked. If there is a difference Only when the hash values of the suffixes are different, the method list corresponding to the current page is reconstructed according to the identity identifier of the current page and the method in the second method list.
  • the URL of the current page WebView can be retrieved, and the difference between the URL and the URL of the second method list can be checked.
  • the URL of the current page WebView is used as the key, and the method in the second method list is used as the value.
  • the API support table corresponding to the current page WebView is constructed. After that, when the client status changes and needs to be notified to the web page, you can query the current page WebView corresponding API support table, select the correct calling method and service type, etc., such as AppBase as the type, and then select identifier and params to construct a message, and initiate a call through executeActionInWeb, so that when a page jump occurs on the web side, the web side does not need to be renewed By registering the second method list, you can notify the current page of the web client of the status change of the client.
  • Step 409 The control webpage receives the fourth message by monitoring the third communication interface, and performs corresponding processing on the fourth message to obtain the second processing result, and constructs the second processing result according to the second processing result and the method identifier contained in the fourth message. Five messages, the fifth message is returned to the client through the fourth communication interface.
  • the second processing result is included in the calling result in the fifth message.
  • the client or the web page is updated, such as when a call to the other party is newly added, or when different services support different types of calls, since the web page is detected to be started in the client,
  • the client and the webpage inform each other of the methods available to call in advance, so the compatibility issues of multiple versions and multiple methods can be handled well, and the probability of unexpected call failures can be reduced.
  • the client and the web page can call each other, and the caller sets the currently called method identifier to facilitate tracking of the calling path, thereby standardizing the method call process between the client and the web page.
  • Fig. 6 is a structural block diagram of a communication device provided by Embodiment 6 of the present invention.
  • the device can be implemented by software and/or hardware, can be integrated in a smart terminal device, and can realize communication between a client and a webpage through a communication method. Communication.
  • the device performs communication based on the data structure provided by the embodiment of the present invention, and includes: a call initiation module 601 and a call feedback module 602.
  • the call initiation module 601 is set to control the web page to send a first message for invoking the first method to the client through the first communication interface after detecting that the web page is started in the client;
  • Call the feedback module 602 set to control the client to receive the first message by listening to the first communication interface, and perform corresponding processing on the first message to obtain the first processing result, and according to the first communication interface
  • a processing result and the method identifier included in the first message construct a second message, and the second message is returned to the web page through a second communication interface, wherein the first processing result is included in the first message
  • the call result in the second message set to control the client to receive the first message by listening to the first communication interface, and perform corresponding processing on the first message to obtain the first processing result, and according to the first communication interface
  • a processing result and the method identifier included in the first message construct a second message, and the second message is returned to the web page through a second communication interface, wherein the first processing result is included in the first message
  • the call result in the second message set to control the client to receive the first message by listening to the first communication interface, and perform corresponding processing on the first message to obtain the first processing result, and according to the first communication interface
  • the communication device is applied to message transfer between a client and a webpage embedded in the client.
  • the webpage After detecting that the webpage is started in the client, the webpage is controlled to communicate to the client through the first communication interface.
  • the client sends the first message for invoking the first method.
  • the client receives the first message by monitoring the first communication interface, it performs corresponding processing on the first message to obtain the first processing result, and according to the first processing result and
  • the method identifier contained in the first message constructs the second message, and returns the second message to the web page through the second communication interface. Because in the message transmission process, both the first message and the second message contain the first message that needs to be called.
  • the method is a unique identifier for this call. Therefore, the client and web page can track the call path of the entire call process based on the unique identifier, thereby standardizing the communication between the client and the web page, effectively avoiding communication confusion The problem.
  • the communication device provided by the embodiment of the present invention can execute the communication method provided by the embodiment of the present invention, and has functional modules and effects corresponding to the execution method.
  • the embodiment of the present invention also provides a storage medium containing computer-executable instructions, which are used to execute the communication method provided in the embodiment of the present invention when the computer-executable instructions are executed by a computer processor, and the method includes:
  • the method identifier included in a message constructs a second message, and returns the second message to the web page through a second communication interface, wherein the first processing result is included in the calling result in the second message .
  • An embodiment of the present invention provides a storage medium containing computer-executable instructions.
  • the computer-executable instructions are not limited to the above-mentioned communication operations, and can also perform related operations in the communication method provided in any corresponding embodiment of the present invention. .
  • FIG. 7 is a structural block diagram of an intelligent terminal device provided by Embodiment 8 of the present invention.
  • the intelligent terminal device 700 includes a memory 701, a processor 702, and a computer program that is stored on the memory 701 and can run on the processor 702.
  • the processor 702 implements the communication method provided by the embodiment of the present invention when the computer program is executed. The method includes:
  • the method identifier included in a message constructs a second message, and returns the second message to the web page through a second communication interface, wherein the first processing result is included in the calling result in the second message .
  • the client and the web page can track the call path of the entire calling process according to the unique identifier, thereby standardizing the communication between the client and the web page, and effectively avoiding communication confusion. problem.
  • the communication device, storage medium, and smart terminal device provided in the foregoing embodiments can execute the communication method provided in any embodiment of the present invention, and have the corresponding functional modules and effects for executing the method.
  • the communication method provided in any embodiment of the present invention can execute the communication method provided in any embodiment of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

Disclosed in the text are a data structure, a communication method and apparatus, a storage medium and a device. The communication method is used for communication on the basis the data structure provided in the present disclosure. The method comprises: after it is detected that a webpage end is started in a client, controlling the webpage end to send, by means of first communication interface, a first message for calling a first method to the client; and controlling the client to receive the first message by monitoring the first communication interface, and performing corresponding processing on the first message to obtain a first processing result, constructing a second message according to the first processing result and a method identifier contained in the first message, and returning the second message to the webpage end by means of a second communication interface.

Description

数据结构、通信方法、装置、存储介质及设备Data structure, communication method, device, storage medium and equipment
本申请要求在2019年11月29日提交中国专利局、申请号为201911207484.6的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office with an application number of 201911207484.6 on November 29, 2019. The entire content of this application is incorporated into this application by reference.
技术领域Technical field
本公开涉及计算机技术领域,例如涉及数据结构、通信方法、装置、存储介质及设备。The present disclosure relates to the field of computer technology, for example, to data structures, communication methods, devices, storage media, and equipment.
背景技术Background technique
随着智能终端应用的普及,智能终端中除了浏览器可以浏览网页之外,更多的应用程序也被要求设定可进行网页浏览的功能,因此,客户端软件设计出现越来越多的内嵌网页的需求,且嵌入页面可以提高开发速度以及降低开发成本,已得到广泛应用。With the popularization of smart terminal applications, in addition to browsers that can browse web pages in smart terminals, more applications are also required to set up functions that can be used to browse web pages. Therefore, more and more internal client software designs appear. The need for embedded web pages, which can increase the development speed and reduce development costs, has been widely used.
然而,网页端(又称前端)和客户端是两个不同的软件体系,两者在通信过程中会出现较多问题。相关技术中,客户端通过javascript(js)注入的方式向网页端声明调用方法列表,并实现与网页端通信,但是在基本通信过程中会出现如两端沟通内容复杂以及无法跟踪调用路径等问题。However, the web side (also known as the front-end) and the client are two different software systems, and there will be more problems in the communication process between the two. In related technologies, the client declares the calling method list to the web page through javascript (js) injection, and realizes communication with the web page. However, in the basic communication process, problems such as the complexity of the communication between the two ends and the inability to track the call path will occur. .
发明内容Summary of the invention
本公开提供了数据结构、通信方法、装置、存储介质及设备,可以优化客户端与内嵌的网页端之间的通信方案。The present disclosure provides data structures, communication methods, devices, storage media, and equipment, which can optimize the communication scheme between the client and the embedded webpage.
提供了一种数据结构,应用于客户端与网页端之间的消息传递,所述网页端嵌入到所述客户端内并与本地层进行交互,所述数据结构包括:A data structure is provided for message transfer between a client and a web page, the web page is embedded in the client and interacts with a local layer, and the data structure includes:
调用方法,用于表示请求调用的方法;Call method, used to indicate the method requested to be called;
方法标识,用于表示所述调用方法的本次调用对应的唯一标识,所述方法标识在用于请求调用的消息中和用于反馈调用结果的消息中保持一致;The method identifier is used to indicate the unique identifier corresponding to this invocation of the method invoking, and the method identifier is consistent in the message used to request the invocation and the message used to feedback the invocation result;
调用参数,用于表示所述调用方法的本次调用对应的参数。The call parameter is used to indicate the parameter corresponding to this call of the call method.
其中,在所述数据结构存在于用于反馈调用结果的消息中的情况下,所述数据结构还包括调用结果。Wherein, in a case where the data structure exists in a message for feeding back the call result, the data structure further includes the call result.
还提供了一种通信方法,该方法基于本公开提供的数据结构进行通信,包括:A communication method is also provided, which communicates based on the data structure provided in the present disclosure, including:
检测到网页端在客户端中启动后,控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息;After detecting that the webpage is started in the client, controlling the webpage to send a first message for invoking the first method to the client through the first communication interface;
控制所述客户端通过监听所述第一通信接口来接收所述第一消息,并针对所述第一消息进行相应的处理,得到第一处理结果,根据所述第一处理结果和所述第一消息中包含的方法标识构造第二消息,通过第二通信接口将所述第二消息返回至所述网页端,其中,所述第一处理结果包含于所述第二消息中的调用结果中。Control the client to receive the first message by monitoring the first communication interface, and perform corresponding processing on the first message to obtain a first processing result, and according to the first processing result and the first processing result The method identifier included in a message constructs a second message, and returns the second message to the web page through a second communication interface, wherein the first processing result is included in the calling result in the second message .
还提供了一种通信装置,该装置基于本公开提供的数据结构进行通信,包括:A communication device is also provided, which performs communication based on the data structure provided in the present disclosure, including:
调用发起模块,设置为检测到网页端在客户端中启动后,控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息;A call initiation module configured to control the web page to send a first message for invoking the first method to the client through the first communication interface after detecting that the web page is started in the client;
调用反馈模块,设置为控制所述客户端通过监听所述第一通信接口来接收所述第一消息,并针对所述第一消息进行相应的处理,得到第一处理结果,根据所述第一处理结果和所述第一消息中包含的方法标识构造第二消息,通过第二通信接口将所述第二消息返回至所述网页端,其中,所述第一处理结果包含于所述第二消息中的调用结果中。Call the feedback module, set to control the client to receive the first message by listening to the first communication interface, and perform corresponding processing on the first message to obtain a first processing result, according to the first The processing result and the method identifier included in the first message construct a second message, and the second message is returned to the web page through a second communication interface, wherein the first processing result is included in the second In the call result in the message.
还提供了一种计算机可读存储介质,存储有计算机程序,该计算机程序被处理器执行时实现如本发明实施例提供的通信方法。A computer-readable storage medium is also provided, which stores a computer program, and when the computer program is executed by a processor, the communication method as provided in the embodiment of the present invention is realized.
还提供了一种智能终端设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如本发明实施例提供的通信方法。An intelligent terminal device is also provided, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The processor implements the communication method as provided in the embodiment of the present invention when the processor executes the computer program. .
附图说明Description of the drawings
图1为本发明实施例二提供的一种通信方法的流程示意图;FIG. 1 is a schematic flowchart of a communication method according to Embodiment 2 of the present invention;
图2为本发明实施例三提供的一种通信方法的流程示意图;2 is a schematic flowchart of a communication method according to Embodiment 3 of the present invention;
图3为本发明实施例四提供的一种通信方法的流程示意图;3 is a schematic flowchart of a communication method provided by Embodiment 4 of the present invention;
图4为本发明实施例五提供的一种通信方法的流程示意图;4 is a schematic flowchart of a communication method according to Embodiment 5 of the present invention;
图5为本发明实施例五提供的一种方法注册的流程示意图;FIG. 5 is a schematic flowchart of a method registration provided by Embodiment 5 of the present invention;
图6为本发明实施例六提供的一种通信装置的结构框图;6 is a structural block diagram of a communication device provided by Embodiment 6 of the present invention;
图7为本发明实施例八提供的一种智能终端设备的结构框图。FIG. 7 is a structural block diagram of an intelligent terminal device provided by Embodiment 8 of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本公开进行说明。附图中仅示出了与本公开相关的部分而非全部结构。此外,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。The present disclosure will be described below with reference to the drawings and embodiments. The drawings only show parts related to the present disclosure, but not all of the structures. In addition, in the case of no conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.
实施例一Example one
本发明实施例提供一种数据结构,应用于客户端与网页端之间的消息传递,所述网页端嵌入到所述客户端内并与本地层进行交互,所述数据结构包括调用方法、方法标识和调用参数,其中,当所述数据结构存在于用于反馈调用结果的消息中时,所述数据结构还包括调用结果。The embodiment of the present invention provides a data structure, which is applied to message transfer between a client and a web page. The web page is embedded in the client and interacts with the local layer. The data structure includes a calling method and a method. Identification and call parameters, where, when the data structure exists in a message used to feed back the call result, the data structure also includes the call result.
在一实施例中,调用方法用于表示请求调用的方法;方法标识用于表示所述调用方法的本次调用对应的唯一标识,所述方法标识在用于请求调用的消息中和用于反馈调用结果的消息中保持一致;调用参数用于表示所述调用方法的本次调用对应的参数。In one embodiment, the calling method is used to indicate the method requested to be called; the method identifier is used to indicate the unique identifier corresponding to this invocation of the calling method, and the method identifier is used in the message for requesting the calling and used for feedback. The message of the calling result is consistent; the calling parameter is used to indicate the parameter corresponding to the current calling of the calling method.
本发明实施例中,客户端可理解为安装在智能终端设备中的应用程序,智能终端设备可包括智能手机、平板电脑、笔记本电脑、计算机以及智能家电等能够装载操作系统的设备。本发明实施例对智能终端设备中装载的操作系统类型不做限定,例如可以是安卓(Android)操作系统、窗口(Windows)操作系统以及苹果(iPhone Operation System,IOS)操作系统等等。当应用于移动终端时,客户端可称为移动客户端。网页端又可称为Web端或前端,可包括如Web页面或Web组件,Web组件例如可以包括在客户端中以浮窗等形式出现的如抽奖框等嵌入Web组件。本地层即Native层,可提供如电话、信息以及相机等系统应用涉及的方法,也可提供移动终端中其他应用程序涉及的方法,网页端通过与客户端的交互,可以对Native层提供的方法进行调用。网页端可通过向客户端调用方法来实现多种功能,如获取信息,包括获取用户令牌等;如使用客户端应用程序(Application,App)相关特性,包括改变窗体结构、分享功能、拍照功能以及应用内跳转等等。In the embodiment of the present invention, the client can be understood as an application program installed in a smart terminal device. The smart terminal device may include devices capable of loading operating systems such as smart phones, tablet computers, notebook computers, computers, and smart home appliances. The embodiment of the present invention does not limit the type of operating system loaded in the smart terminal device. For example, it may be an Android operating system, a Windows operating system, an iPhone Operation System (IOS) operating system, and so on. When applied to a mobile terminal, the client can be referred to as a mobile client. The web page can also be referred to as a web or front end, and can include, for example, a web page or a web component. The web component can include, for example, an embedded web component such as a lottery box that appears in the form of a floating window in the client. The native layer is the Native layer, which can provide methods related to system applications such as phones, information, and cameras, as well as methods related to other applications in the mobile terminal. The web page can interact with the client to perform the methods provided by the Native layer. transfer. The web page can implement multiple functions by calling methods to the client, such as obtaining information, including obtaining user tokens, etc.; such as using client application (Application, App) related features, including changing the structure of the form, sharing functions, and taking pictures Functions and in-app jumps and so on.
相关技术中,客户端通过js注入的方式向网页端声明调用方法列表,并实现与网页端通信,但是在基本通信过程中会出现如两端沟通内容复杂以及无法跟踪调用路径等问题。例如,网页端向客户端分别发起两次调用,分别记为a调用和b调用,两次调用可以是针对同一方法的调用或分别针对两个方法的调 用,客户端在接收到网页端的调用后,会进行相应的处理并反馈处理结果,针对两次调用会反馈两个不同的处理结果,分别记为结果a和结果b,然而,由于两次调用异步进行,处理过程耗时也不相同,因此,网页端无法根据时序确认收到的结果a和结果b分别对应哪次调用,就会出现混乱。In related technologies, the client declares the calling method list to the web page through js injection, and realizes communication with the web page. However, in the basic communication process, problems such as complicated communication between the two ends and the inability to track the call path may occur. For example, the web page initiates two calls to the client, which are recorded as a call and b call. The two calls can be calls to the same method or calls to two methods respectively. After the client receives the call from the web page , The corresponding processing will be performed and the processing result will be fed back. Two different processing results will be fed back for the two calls, which are recorded as result a and result b respectively. However, since the two calls are performed asynchronously, the processing time is different. Therefore, the web page cannot confirm which call the received result a and result b correspond to according to the time sequence, and confusion will occur.
本发明实施例中,提供了一种数据结构,客户端与网页端之间可以基于该数据结构构建用于进行通信的消息。该数据结构中,不仅包含需要进行调用的方法以及对应的参数,还包含了用于表示调用方法的本次调用对应的唯一标识,称为方法标识。方法标识在用于请求调用的消息中和对应的用于反馈调用结果的消息中保持一致,这样,通信双方就可以通过方法标识实现调用路径的追踪。示例性的,方法标识可以由调用方设定,例如,当网页端向客户端发起调用时,网页端可以在用于请求调用的消息中设定针对本次调用的方法标识,而客户端可以从接收到的消息中提取到方法标识并加入用于反馈调用结果的消息中,反馈给网页端。In the embodiment of the present invention, a data structure is provided, and a message for communication can be constructed between the client and the web page based on the data structure. The data structure not only contains the method to be called and the corresponding parameters, but also contains the unique identifier corresponding to the current call for the method to be called, which is called the method identifier. The method identifier is consistent in the message used to request the call and the corresponding message used to feedback the call result. In this way, both parties in communication can track the call path through the method identifier. Exemplarily, the method identification can be set by the caller. For example, when the webpage initiates a call to the client, the webpage can set the method identification for this call in the message used to request the call, and the client can Extract the method identifier from the received message and add it to the message used to feed back the call result, and feed it back to the web page.
示例性的,调用结果中可包括错误码、错误信息和参数信息。若调用成功,错误码和错误信息可默认为空或0,若本次调用出现异常,可在调用结果中通过错误码和错误信息来表示异常的类型和原因。参数信息中可包括调用方针对本次调用的处理结果信息。Exemplarily, the call result may include error code, error information, and parameter information. If the call is successful, the error code and error message can be blank or 0 by default. If an exception occurs in this call, the error code and error message can be used in the call result to indicate the type and cause of the exception. The parameter information may include the processing result information of the caller for this call.
可选的,本发明实施例中的数据结构还可以包括业务类型。这样设置的好处在于,可以按照不同业务的特性对所涉及的方法进行分类,方便被调用方快速根据业务类型找到对应的方法以及方法对应的执行对象。所述数据结构中还包括业务类型,所述业务类型用于表示所述调用方法对应的业务种类。Optionally, the data structure in the embodiment of the present invention may also include a service type. The advantage of this setting is that the methods involved can be classified according to the characteristics of different services, so that the callee can quickly find the corresponding method and the execution object corresponding to the method according to the service type. The data structure also includes a service type, and the service type is used to indicate the service type corresponding to the calling method.
示例性的,假设网页端为调用方,客户端为被调用方,那么网页端向客户端发送的消息可记为ClientAciton(客户端行为),客户端向网页端反馈的消息可记为WebAciton(网页端行为)。Exemplarily, assuming that the web page is the caller and the client is the callee, then the message sent by the web page to the client can be recorded as ClientAciton (client behavior), and the message feedback from the client to the web page can be recorded as WebAciton ( Web-side behavior).
例如,ClientAciton可包含如下数据结构:For example, ClientAciton can contain the following data structure:
Figure PCTCN2020107463-appb-000001
Figure PCTCN2020107463-appb-000001
又如,WebAciton可包含如下数据结构:For another example, WebAciton can contain the following data structures:
Figure PCTCN2020107463-appb-000002
Figure PCTCN2020107463-appb-000002
其中,定义result符合以下结构:Among them, the definition result conforms to the following structure:
Figure PCTCN2020107463-appb-000003
Figure PCTCN2020107463-appb-000003
本发明实施例中提供的数据结构,应用于客户端与内嵌在客户端中的网页端之间的消息传递,从而实现网页端与本地层的交互,由于在消息传递过程中,数据结构包含了需要调用的方法的针对本次调用的唯一标识,因此,客户端和网页端可以根据该唯一标识对整个调用过程的调用路径进行追踪,从而规范了客户端和网页端之间的通信,有效避免出现通信混乱的问题。The data structure provided in the embodiment of the present invention is applied to the message transfer between the client and the webpage embedded in the client, so as to realize the interaction between the webpage and the local layer. Because in the message transfer process, the data structure contains The unique identifier of the method that needs to be called for this call. Therefore, the client and the web page can track the call path of the entire call process based on the unique identifier, thus standardizing the communication between the client and the web page, and effectively Avoid the problem of communication confusion.
实施例二Example two
图1为本发明实施例二提供的一种通信方法的流程示意图,该方法可以由通信装置执行,其中该装置可由软件和/或硬件实现,可集成在智能终端设备中。如图1所示,该方法包括:步骤101至步骤102。FIG. 1 is a schematic flowchart of a communication method according to Embodiment 2 of the present invention. The method can be executed by a communication device, where the device can be implemented by software and/or hardware, and can be integrated in a smart terminal device. As shown in Fig. 1, the method includes: step 101 to step 102.
步骤101、检测到网页端在客户端中启动后,控制网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息。Step 101: After detecting that the webpage terminal is started in the client terminal, control the webpage terminal to send a first message for invoking the first method to the client terminal through the first communication interface.
示例性的,检测到网页端在客户端中启动,可理解为在客户端中打开网页。当网页端需要通过与客户端的通信来调用第一方法时,可以按照本发明实施例提供的数据结构来构建第一消息,并发送至客户端。例如,第一消息中的调用方法中为第一方法,可以是第一方法的名称或代码等,方法标识为网页端针对本次调用设定的唯一标识,调用参数为第一方法的本次调用对应的参数。Exemplarily, if it is detected that the web page is started in the client, it can be understood as opening the web page in the client. When the web page needs to call the first method through communication with the client, the first message can be constructed according to the data structure provided in the embodiment of the present invention and sent to the client. For example, the calling method in the first message is the first method, which can be the name or code of the first method, etc. The method identifier is the unique identifier set by the web page for this call, and the calling parameter is the current call of the first method. Call the corresponding parameters.
示例性的,第一通信接口可以通过js方法实现,网页端可通过该js方法向客户端传递第一消息。可选的,第一通信接口可称为executeActionInClient。Exemplarily, the first communication interface may be implemented through a js method, and the webpage terminal may transmit the first message to the client through the js method. Optionally, the first communication interface may be called executeActionInClient.
步骤102、控制客户端通过监听第一通信接口来接收第一消息,并针对第一消息进行相应的处理,得到第一处理结果,根据第一处理结果和第一消息中包含的方法标识构造第二消息,通过第二通信接口将第二消息返回至网页端。Step 102: The control client receives the first message by monitoring the first communication interface, and performs corresponding processing on the first message to obtain the first processing result, and constructs the first processing result according to the first processing result and the method identifier contained in the first message. Second message, the second message is returned to the web page through the second communication interface.
在一实施例中,第一处理结果包含于第二消息中的调用结果中。In an embodiment, the first processing result is included in the calling result in the second message.
示例性的,客户端通过对第一通信接口的监听来接收网页端传递过来的第一消息,通过对第一消息中的数据结构的内容进行提取来确认本次调用的需求,进而进行相应的处理,得到第一处理结果。随后,根据从第一消息中提取出来的方法标识与第一处理结果一起构建第二消息,并通过第二通信接口反馈给网页端实现结果回调,第一处理结果包含于第二消息的调用结果中。Exemplarily, the client receives the first message delivered by the web page by monitoring the first communication interface, and confirms the requirements of this call by extracting the content of the data structure in the first message, and then performs the corresponding Processing to obtain the first processing result. Subsequently, a second message is constructed according to the method identifier extracted from the first message together with the first processing result, and fed back to the web page through the second communication interface to realize the result callback. The first processing result is included in the call result of the second message in.
示例性的,第二通信接口可以通过js方法实现,客户端可利用该js方法向前端回调执行结果。可选的,第二通信接口可称为callbackInWeb。示例性的,在网页端可以预先编写用于支持调用的js文件,如base.js,这些文件需要实现第一通信接口和第二通信接口的方法,并规范化调用过程中消息的生产方式。Exemplarily, the second communication interface may be implemented by a js method, and the client may use the js method to call back the execution result to the front end. Optionally, the second communication interface may be called callbackInWeb. Exemplarily, js files for supporting calling can be pre-written on the web page, such as base.js, these files need to implement the methods of the first communication interface and the second communication interface, and standardize the message production method in the calling process.
可选的,所述针对所述第一消息进行相应的处理,包括:根据所述第一消息通知所述第一方法对应的目标执行对象执行相应的操作,并将所述目标执行对象的执行结果确定为第一处理结果。示例性的,以iOS客户端的WKWebView为例,获取第一通信接口executeActionInClient传递过来的第一消息,设计WKWebViewJSDispatcher对第一消息进行转发,如将type为AppBase的消息转发给AppBaseModel(目标执行对象)处理。当AppBaseModel接受到消息时,做出对应处理行为,并且将传入第一消息中的identifier取出,作为回传参数的identifier,通过第二通信接口callbackInWeb传递第二消息给网页端,用于表明调用路径。Optionally, the corresponding processing for the first message includes: notifying the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and executing the target execution object The result is determined as the first processing result. Exemplarily, take WKWebView of the iOS client as an example, obtain the first message passed by the first communication interface executeActionInClient, and design WKWebViewJSDispatcher to forward the first message, such as forwarding a message of type AppBase to AppBaseModel (target execution object) for processing . When AppBaseModel receives the message, it makes corresponding processing actions, and takes out the identifier in the incoming first message as the identifier of the return parameter, and passes the second message to the web page through the second communication interface callbackInWeb to indicate the call path.
本发明实施例中提供的通信方法,应用于客户端与内嵌在客户端中的网页端之间的消息传递,检测到网页端在客户端中启动后,控制网页端通过第一通信接口向客户端发送用于调用第一方法的第一消息,客户端通过监听第一通信接口接收到第一消息后,针对第一消息进行相应的处理,得到第一处理结果,根据第一处理结果和第一消息中包含的方法标识构造第二消息,通过第二通信接口将第二消息返回至网页端,由于在消息传递过程中,第一消息和第二消息中均包含了需要调用的第一方法的针对本次调用的唯一标识,因此,客户端和网页端可以根据该唯一标识对整个调用过程的调用路径进行追踪,从而规范了客户端和网页端之间的通信,有效避免出现通信混乱的问题。The communication method provided in the embodiment of the present invention is applied to the message transmission between the client and the webpage embedded in the client. After detecting that the webpage is started in the client, the webpage is controlled to communicate to the client through the first communication interface. The client sends the first message for invoking the first method. After the client receives the first message by monitoring the first communication interface, it performs corresponding processing on the first message to obtain the first processing result, and according to the first processing result and The method identifier contained in the first message constructs the second message, and returns the second message to the web page through the second communication interface. Because in the message transmission process, both the first message and the second message contain the first message that needs to be called. The method is a unique identifier for this call. Therefore, the client and web page can track the call path of the entire call process based on the unique identifier, thereby standardizing the communication between the client and the web page, effectively avoiding communication confusion The problem.
在上述实施例的基础上,在所述控制所述客户端通过监听所述第一通信接口来接收所述第一消息之后,还包括:若确定本地层不允许调用所述第一方法,则根据所述第一消息中包含的方法标识构造第三消息,将所述第三消息通过所述第二通信接口返回至所述网页端,所述第三消息中的调用结果中包含错误信息。示例性的,对于不同版本的客户端来说,本地层支持的方法可能存在差异,对于一些旧版本的客户端来说,网页端所要调用的方法可能不存在,因此,本地层也就无法支持调用,相当于不允许调用。另外,出于一些安全性等因素的考虑,本地层可能有一些方法不希望被网页端调用,因此,也不允许调用。此处的好处在于,当调用失败时,网页端可以立即知晓当前客户端不支持对应方法,不会产生错误的后续活动。可选的,调用结果中包含404错误码以及错误信息msg(如相关错误提示),网页端在接收到第三消息后,可按照自己的策略进行相应的处理。On the basis of the foregoing embodiment, after the controlling the client to receive the first message by listening to the first communication interface, the method further includes: if it is determined that the local layer does not allow the calling of the first method, then A third message is constructed according to the method identifier included in the first message, the third message is returned to the web page through the second communication interface, and the calling result in the third message contains error information. Exemplarily, for different versions of the client, the methods supported by the local layer may be different. For some old versions of the client, the method to be called by the web page may not exist. Therefore, the local layer cannot support it. Calling is equivalent to not allowing calls. In addition, due to some security and other factors, there may be some methods in the local layer that do not want to be called by the web page. Therefore, they are not allowed to be called. The advantage here is that when the call fails, the web page can immediately know that the current client does not support the corresponding method, and no wrong follow-up activities will be generated. Optionally, the call result contains a 404 error code and an error message msg (such as a related error prompt). After receiving the third message, the web page can perform corresponding processing according to its own strategy.
实施例三Example three
图2为本发明实施例三提供的一种通信方法的流程示意图,在上述实施例的基础上,增加了接口注册的相关内容。Fig. 2 is a schematic flowchart of a communication method provided in the third embodiment of the present invention. On the basis of the above-mentioned embodiment, relevant content of interface registration is added.
示例性的,在所述检测到网页端在客户端中启动后,还包括:控制所述客户端向所述网页端注册所述第一通信接口和所述第二通信接口。Exemplarily, after detecting that the webpage terminal is started in the client terminal, the method further includes: controlling the client terminal to register the first communication interface and the second communication interface with the webpage terminal.
在一实施例中,所述控制所述客户端向所述网页端注册所述第一通信接口和所述第二通信接口,包括:获取所述网页端的当前网页的身份标识;根据所述身份标识查询预设授权信息,若根据查询结果确定所述当前网页为已授权状态,则控制所述客户端向所述网页端注册所述第一通信接口和所述第二通信接口。In an embodiment, the controlling the client to register the first communication interface and the second communication interface with the web page includes: obtaining the identity of the current web page of the web page; and according to the identity Identify and query preset authorization information, and if the current web page is determined to be in an authorized state according to the query result, control the client to register the first communication interface and the second communication interface with the web page.
在一实施例中,该方法可包括:步骤201至步骤209。In an embodiment, the method may include: step 201 to step 209.
步骤201、检测到网页端在客户端中启动。Step 201: It is detected that the web page is started in the client.
步骤202、获取网页端的当前网页的身份标识,根据身份标识查询预设授权信息。Step 202: Obtain the identity of the current webpage on the webpage side, and query preset authorization information according to the identity.
示例性的,出于安全性等因素的考虑,可以预先设置授权信息,该授权信息中可包含允许采用本发明实施例的通信方法与客户端进行通信的网页的身份标识,该身份标识例如可以是统一资源定位符(Uniform Resource Locator,URL)。在客户端维护该预设授权信息,以便根据最新的预设授权信息确定是否允许当前网页的调用。Exemplarily, for the consideration of security and other factors, authorization information may be set in advance, and the authorization information may include the identity of the webpage that allows the communication method of the embodiment of the present invention to communicate with the client. The identity may be, for example, It is a Uniform Resource Locator (URL). The preset authorization information is maintained on the client, so as to determine whether to allow the call of the current webpage according to the latest preset authorization information.
步骤203、根据查询结果确定当前网页是否为已授权状态,若是,则执行步骤204;否则,结束流程。Step 203: Determine whether the current webpage is in an authorized state according to the query result, if yes, go to step 204; otherwise, end the process.
步骤204、控制客户端向网页端注册第一通信接口和第二通信接口。Step 204: Control the client to register the first communication interface and the second communication interface with the web page.
示例性的,若当前网页为已授权状态,说明可以允许当前网页与客户端进行通信。第一通信接口和第二通信接口可以通过js方法实现,可以通过向网页端注册对应的js方法的方式实现第一通信接口和第二通信接口的注册。可选的,可以将第一通信接口以及第二通信接口注册到网页端的信息处理句柄中,以IOS操作系统为例,信息处理句柄可以是ScriptMessageHandler,其他操作系统中可以是其他名称的实现消息处理句柄功能的对象。Exemplarily, if the current webpage is in an authorized state, it means that the current webpage can be allowed to communicate with the client. The first communication interface and the second communication interface can be realized by the js method, and the registration of the first communication interface and the second communication interface can be realized by registering the corresponding js method to the web page. Optionally, the first communication interface and the second communication interface can be registered in the information processing handle on the web page. Taking the IOS operating system as an example, the information processing handle can be ScriptMessageHandler, and in other operating systems, other names can be used to implement message processing. The object of the handle function.
步骤205、控制网页端通过第一通信接口向客户端发送用于调用第一方法的第一消息。Step 205: Control the web terminal to send a first message for invoking the first method to the client through the first communication interface.
步骤206、控制客户端通过监听第一通信接口来接收第一消息。Step 206: The control client receives the first message by monitoring the first communication interface.
步骤207、控制客户端判断本地层是否允许调用第一方法,若是,则执行步骤208;否则,执行步骤209。Step 207: The control client determines whether the first method is allowed to be called by the local layer, and if so, execute step 208; otherwise, execute step 209.
步骤208、控制客户端根据第一消息通知第一方法对应的目标执行对象执行相应的操作,并将目标执行对象的执行结果确定为第一处理结果,根据第一处理结果和第一消息中包含的方法标识构造第二消息,通过第二通信接口将第二消息返回至网页端。Step 208: The control client notifies the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and determines the execution result of the target execution object as the first processing result, and according to the first processing result and the first message contains The method identifier constructs a second message, and returns the second message to the web page through the second communication interface.
步骤209、控制客户端根据第一消息中包含的方法标识构造第三消息,将第三消息通过第二通信接口返回至网页端,第三消息中的调用结果中包含错误信息。Step 209: The control client constructs a third message according to the method identifier contained in the first message, and returns the third message to the web page through the second communication interface, and the call result in the third message contains error information.
本发明实施例提供的通信方法,在检测到网页端在客户端中启动后,获取网页端的当前网页的身份标识,根据身份标识查询预设授权信息,以确定本地层是否允许当前网页进行通信,若允许,则向网页端注册第一通信接口和第二通信接口,以建立客户端与网页端的通信通道,随后,网页端可以通过第一通信接口发送用于调用第一方法的第一消息,客户端接收到第一消息后,通知目标执行对象进行处理,并根据处理结果和第一消息中的方法标识构建第二消息反馈给网页端,以使网页端追踪调用路径,当第一方法不允许调用时,向网页端反馈包含错误信息的第三消息,让网页端及时知晓调用失败,阻止产生错误的后续活动。The communication method provided by the embodiment of the present invention, after detecting that the web page is started in the client, obtains the identity of the current web page of the web page, and queries preset authorization information according to the identity to determine whether the local layer allows the current web page to communicate, If allowed, register the first communication interface and the second communication interface with the web page to establish a communication channel between the client and the web page. Then, the web page can send the first message for invoking the first method through the first communication interface, After receiving the first message, the client informs the target execution object to process, and constructs a second message based on the processing result and the method identifier in the first message to feed back to the web page, so that the web page can track the calling path. When the call is allowed, the third message containing the error information is fed back to the web page to let the web page know that the call failed in time and prevent subsequent activities that cause errors.
实施例四Example four
图3为本发明实施例四提供的一种通信方法的流程示意图,在上述实施例的基础上,增加了控制客户端向网页端注册本地层允许网页端的当前网页进行调用的方法的相关步骤。Fig. 3 is a schematic flow chart of a communication method provided by the fourth embodiment of the present invention. On the basis of the above-mentioned embodiment, the relevant steps of the method of controlling the client to register the local layer with the webpage to allow the current webpage of the webpage to be called are added.
示例性的,在所述控制所述客户端向所述网页端注册所述第一通信接口之 后,还包括:控制所述客户端向所述网页端注册本地层允许所述网页端的当前网页进行调用的方法,得到第一方法列表。这样设置的好处在于,可以提前通知网页端可调用方法,有效降低产生非预期调用的概率。Exemplarily, after the controlling the client to register the first communication interface with the web page, the method further includes: controlling the client to register a local layer with the web page to allow the current web page of the web page to perform Called method, get the first method list. The advantage of this setting is that it can notify the web page to call the method in advance, effectively reducing the probability of unexpected calls.
在一实施例中,所述控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息,包括:控制所述网页端查询所述第一方法列表中是否包含当前需要调用的第一方法,若包含,则构造用于调用所述第一方法的第一消息,并通过第一通信接口向所述客户端发送所述第一消息。这样设置的好处在于,网页端在发起调用之前可以先通过查询第一方法列表的方式确定客户端是否允许当前所需方法的调用,若允许,再构造第一消息,避免进行后续的无用操作。In an embodiment, the controlling the web page to send a first message for invoking the first method to the client via a first communication interface includes: controlling the web page to query the list of the first methods Whether the first method that needs to be called currently is included, if included, construct a first message for invoking the first method, and send the first message to the client through the first communication interface. The advantage of this setting is that before initiating the call, the web page can first determine whether the client allows the call of the currently required method by querying the first method list, and if allowed, construct the first message to avoid subsequent useless operations.
在一实施例中,该方法可包括:步骤301至步骤309。In an embodiment, the method may include: step 301 to step 309.
步骤301、检测到网页端在客户端中启动。Step 301: It is detected that the web page is started in the client.
步骤302、获取网页端的当前网页的身份标识,根据身份标识查询预设授权信息。Step 302: Obtain the identity of the current webpage on the webpage side, and query preset authorization information according to the identity.
步骤303、根据查询结果确定当前网页是否为已授权状态,若是,则执行步骤304;否则,结束流程。Step 303: Determine whether the current webpage is in an authorized state according to the query result, if yes, go to step 304; otherwise, end the process.
步骤304、控制客户端向网页端注册第一通信接口和第二通信接口。Step 304: Control the client to register the first communication interface and the second communication interface with the web page.
步骤305、控制客户端向网页端注册本地层允许网页端的当前网页进行调用的方法,得到第一方法列表。Step 305: Control the client to register with the web page the method that the local layer allows the current web page of the web page to call, and obtain the first method list.
示例性的,可以利用第一预设注册方法,如regMethod,向网页端的消息处理句柄,如ScriptMessageHandler,注册本地层允许网页端的当前网页进行调用的方法。Exemplarily, the first preset registration method, such as regMethod, can be used to register a method that the local layer allows the current web page of the web page to call to the message processing handle of the web page, such as ScriptMessageHandler.
步骤306、控制网页端查询第一方法列表中是否包含需要调用的第一方法,若包含,则执行步骤307;否则,结束流程。Step 306: Control the web page to query whether the first method list includes the first method that needs to be called, and if it does, execute step 307; otherwise, end the process.
步骤307、控制网页端构造用于调用所述第一方法的第一消息,并通过第一通信接口向客户端发送第一消息。Step 307: Control the web terminal to construct a first message for invoking the first method, and send the first message to the client through the first communication interface.
步骤308、控制客户端通过监听第一通信接口来接收第一消息。Step 308: The control client receives the first message by monitoring the first communication interface.
步骤309、控制客户端根据第一消息通知第一方法对应的目标执行对象执行相应的操作,并将目标执行对象的执行结果确定为第一处理结果,根据第一处理结果和第一消息中包含的方法标识构造第二消息,通过第二通信接口将第二消息返回至网页端。Step 309: The control client informs the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and determines the execution result of the target execution object as the first processing result, according to the first processing result and the first message containing The method identifier constructs a second message, and returns the second message to the web page through the second communication interface.
在一实施例中,在根据第一消息通知第一方法对应的目标执行对象执行相 应的操作之前,也可先判断本地层是否允许调用第一方法,若允许,再执行本步骤,若不允许,可根据第一消息中包含的方法标识构造第三消息,将第三消息通过第二通信接口返回至网页端,第三消息中的调用结果中包含错误信息。这样设置的好处在于,虽然网页端已根据第一方法列表进行查询,但仍有可能出现第一方法列表存在错误或者存在其他bug等情况,因此,可以增强本方案的容错性。In one embodiment, before the target execution object corresponding to the first method is notified to perform the corresponding operation according to the first message, it can also be judged whether the local layer is allowed to call the first method. If allowed, perform this step again. If not allowed , The third message can be constructed according to the method identifier contained in the first message, and the third message is returned to the web page through the second communication interface, and the call result in the third message contains error information. The advantage of this setting is that although the web page has been queried according to the first method list, there may still be errors in the first method list or other bugs. Therefore, the fault tolerance of this solution can be enhanced.
本发明实施例提供的通信方法,在检测到网页端在客户端中启动后,在注册第一通信接口之后,还控制客户端向网页端注册第一方法列表,提前通知网页端可调用方法,这样网页端在发起调用之前可以先通过查询第一方法列表的方式确定客户端是否允许当前所需方法的调用,若允许,再构造第一消息,避免进行后续的无用操作,有效降低产生非预期调用的概率。In the communication method provided by the embodiment of the present invention, after detecting that the webpage is started in the client, after registering the first communication interface, the client is also controlled to register the first method list with the webpage, and the webpage is notified in advance that the method can be called, In this way, before initiating the call, the web page can first determine whether the client allows the call of the currently required method by querying the first method list. If allowed, construct the first message to avoid subsequent useless operations and effectively reduce the unexpected Probability of calling.
实施例五Example five
图4为本发明实施例五提供的一种通信方法的流程示意图,在上述实施例的基础上,增加了客户端调用网页端的方法的相关内容。Fig. 4 is a schematic flow chart of a communication method provided by the fifth embodiment of the present invention. On the basis of the above-mentioned embodiment, relevant content of the method for the client to call the webpage is added.
示例性的,在所述检测到网页端在客户端中启动后,还包括:控制所述客户端通过第三通信接口向所述网页端发送用于调用第二方法的第四消息;控制所述网页端通过监听所述第三通信接口来接收所述第四消息,并针对所述第四消息进行相应的处理,得到第二处理结果,根据所述第二处理结果和所述第四消息中包含的方法标识构造第五消息,通过第四通信接口将所述第五消息返回至所述客户端,其中,所述第二处理结果包含于所述第五消息中的调用结果中。这样设置的好处在于,不仅允许网页端调用客户端的方法,客户端也能够实现调用网页端的方法。Exemplarily, after it is detected that the webpage terminal is started in the client terminal, the method further includes: controlling the client terminal to send a fourth message for invoking the second method to the webpage terminal through a third communication interface; The web page receives the fourth message by monitoring the third communication interface, and performs corresponding processing on the fourth message to obtain a second processing result, according to the second processing result and the fourth message The method identifier included in the fifth message constructs a fifth message, and the fifth message is returned to the client through a fourth communication interface, wherein the second processing result is included in the calling result in the fifth message. The advantage of this setting is that it not only allows the web page to call the method on the client side, but the client can also implement the method to call the web side.
在一实施例中,在所述控制所述客户端向所述网页端注册所述第一通信接口之后,还包括:控制所述网页端构造第六消息,并通过所述第一通信接口向所述客户端发送所述第六消息,以实现向所述客户端注册所述网页端的当前页面支持所述客户端调用的方法,其中,所述第六消息中的调用方法为所述本地层提供的注册方法,所述第六消息中的调用参数包括所述网页端的当前页面支持所述客户端调用的方法;控制所述客户端根据所述第六消息生成第二方法列表。这样设置的好处在于,可以提前通知客户端可调用方法,有效降低产生非预期调用的概率。In one embodiment, after the controlling the client to register the first communication interface with the web page, the method further includes: controlling the web page to construct a sixth message, and to send a message to the web through the first communication interface. The client sends the sixth message to realize the method for registering the current page of the web page with the client to support the client invocation, wherein the invocation method in the sixth message is the local layer In the registration method provided, the call parameter in the sixth message includes a method that the current page of the web page supports the client to call; and the client is controlled to generate a second method list according to the sixth message. The advantage of this setting is that the client can be notified in advance that the method can be called, which effectively reduces the probability of unexpected calls.
在一实施例中,所述控制所述客户端通过调用第三通信接口向所述网页端发送用于调用第二方法的第四消息,包括:控制所述客户端查询所述第二方法列表中是否包含当前需要调用的第二方法,若包含,则构造用于调用所述第二方法的第四消息,并通过第三通信接口向所述网页端发送所述第四消息。这样 设置的好处在于,客户端在发起调用之前可以先通过查询第二方法列表的方式确定网页端是否允许当前所需方法的调用,若允许,再构造第二消息,避免进行后续的无用操作。In an embodiment, the controlling the client to send a fourth message for invoking the second method to the web page by invoking a third communication interface includes: controlling the client to query the second method list Whether it contains the second method that needs to be called currently, if it contains, construct a fourth message for invoking the second method, and send the fourth message to the web page through a third communication interface. The advantage of this setting is that before initiating the call, the client can first determine whether the web page allows the call of the currently required method by querying the second method list, and if allowed, construct a second message to avoid subsequent useless operations.
在一实施例中,该方法可包括:步骤401至步骤409。In an embodiment, the method may include: step 401 to step 409.
步骤401、检测到网页端在客户端中启动。Step 401: It is detected that the web page is started in the client.
在检测到网页端在客户端中启动,可先控制客户端向网页端注册第一通信接口和第二通信接口,还可继续控制客户端向网页端注册第三通信接口和第四通信接口。上述四个通信接口均可采用js方法实现。可选的,第一通信接口可称为executeActionInClient,第二通信接口可称为callbackInWeb,第三通信接口可称为executeActionInWeb,第四通信接口可称为callbackInClient。可选的,第三通信接口可以与第一通信接口复用,第四通信接口也可以与第二通信接口复用,这样,在检测到网页端在客户端中启动,控制客户端向网页端注册第一通信接口和第二通信接口即可。When it is detected that the webpage is started in the client, the client can be controlled to register the first communication interface and the second communication interface with the webpage, and the client can be controlled to register the third communication interface and the fourth communication interface with the webpage. All of the above four communication interfaces can be implemented by using the js method. Optionally, the first communication interface may be called executeActionInClient, the second communication interface may be called callbackInWeb, the third communication interface may be called executeActionInWeb, and the fourth communication interface may be called callbackInClient. Optionally, the third communication interface can be multiplexed with the first communication interface, and the fourth communication interface can also be multiplexed with the second communication interface. In this way, when it is detected that the web page is started in the client, the client is controlled to the web page. Just register the first communication interface and the second communication interface.
步骤402、控制客户端向网页端注册本地层允许网页端的当前网页进行调用的方法,得到第一方法列表。Step 402: Control the client to register with the web page the method that the local layer allows the current web page of the web page to call, and obtain the first method list.
示例性的,可以利用第一预设注册方法,如regMethod,向网页端的消息处理句柄,如ScriptMessageHandler,注册本地层允许网页端的当前网页进行调用的方法。Exemplarily, the first preset registration method, such as regMethod, can be used to register a method that the local layer allows the current web page of the web page to call to the message processing handle of the web page, such as ScriptMessageHandler.
步骤403、控制网页端构造第六消息,并通过第一通信接口向客户端发送第六消息,以实现向客户端注册网页端的当前页面支持客户端调用的方法。Step 403: Control the webpage to construct a sixth message, and send the sixth message to the client through the first communication interface, so as to realize the method of registering the current page of the webpage with the client to support client invocation.
在一实施例中,所述第六消息中的调用方法为所述本地层提供的注册方法,所述第六消息中的调用参数包括所述网页端的当前页面支持所述客户端调用的方法。In an embodiment, the calling method in the sixth message is a registration method provided by the local layer, and the calling parameter in the sixth message includes a method that the current page of the web page supports the client to call.
为了便于理解,下面提供一个第六消息中的数据结构作为示意性说明。网页端需要调用客户端中的方法来告知客户端可以调用网页端的哪些方法时,第六消息中的数据结构可以包含如下内容:For ease of understanding, the following provides a data structure in the sixth message as a schematic illustration. When the webpage needs to call methods on the client to inform the client which methods on the webpage can be called, the data structure in the sixth message can contain the following content:
Figure PCTCN2020107463-appb-000004
Figure PCTCN2020107463-appb-000004
Figure PCTCN2020107463-appb-000005
Figure PCTCN2020107463-appb-000005
步骤404、控制客户端根据第六消息生成第二方法列表。Step 404: The control client generates a second method list according to the sixth message.
示例性的,可以将当前网页的URL作为key(键),MethodList(方法列表)作为value(值),构造Map结构的页面应用程序编程接口(Application Programming Interface,API)支持表,也即上述第二方法列表。Exemplarily, the URL of the current webpage can be used as the key, and the MethodList (method list) can be used as the value (value) to construct a page application programming interface (Application Programming Interface, API) support table of the Map structure, that is, the above-mentioned section 2. List of methods.
图5为本发明实施例五提供的一种方法注册的流程示意图,如图所示,客户端(Client)可以利用regMethod方法在ScriptMessageHandler中注册本地层允许网页端的当前网页进行调用的方法,网页端(Web)可以查询第一方法列表,并通过executeActionInClient向客户端发起调用,客户端通过js方法反馈调用结果。网页端可以通过调用本地层的regMethodForUrl方法向客户端注册当前网页允许客户端调用的方法,形成第二方法列表regMethodList,客户端可以查询第二方法列表,并通过executeActionInWeb向网页端发起调用,网页端通过js方法反馈调用结果。其中,在进行调用结果反馈时,第三通信接口可以实现复用,即可均通过callbackInWeb进行调用结果反馈。Figure 5 is a schematic diagram of a method registration process provided by Embodiment 5 of the present invention. As shown in the figure, the client (Client) can use the regMethod method to register the local layer in the ScriptMessageHandler to allow the current web page of the web page to be called. (Web) You can query the first method list, and initiate a call to the client through executeActionInClient, and the client feeds back the call result through the js method. The web page can register with the client the methods that the current web page allows the client to call by calling the local layer regMethodForUrl method to form a second method list regMethodList. The client can query the second method list and initiate a call to the web page through executeActionInWeb. The result of the call is fed back through the js method. Among them, when the call result feedback is performed, the third communication interface can be reused, that is, the call result feedback can be performed through callbackInWeb.
可选的,网页端可在上文所述的base.js文件加载完成后,构造第六消息,并调用executeActionInClient,向客户端注册,之后针对regMethodForUrl中列举的api列表,拦截executeActionInWeb中传递的消息实现监听。Optionally, the web page can construct the sixth message after the base.js file described above is loaded, and call executeActionInClient to register with the client, and then intercept the message passed in executeActionInWeb for the api list listed in regMethodForUrl Realize monitoring.
步骤405、控制网页端确定当前需要调用的第一方法,若查询到第一方法列表中包含第一方法,则控制网页端构造用于调用第一方法的第一消息,并通过第一通信接口向客户端发送第一消息。Step 405: The control webpage determines the first method that needs to be called currently, and if the first method is found in the first method list, the control webpage constructs a first message for invoking the first method, and passes the first communication interface Send the first message to the client.
在一实施例中,在网页端和客户端互相通知对方允许调用的方法之后,任意一方可先发起调用,本发明实施例不做限定,即步骤407至步骤409可以在步骤405和步骤406之前执行。In one embodiment, after the web page and the client notify each other of the methods allowed to be called, either party can initiate the call first. The embodiment of the present invention does not limit it, that is, step 407 to step 409 may be before step 405 and step 406 carried out.
为了便于理解,下面提供一个第一消息中的数据结构作为示意性说明。网页端需要调用客户端Toast提示或者弹窗提示时,第一消息中的数据结构可以包含如下内容:For ease of understanding, the following provides a data structure in the first message as a schematic illustration. When the web page needs to call the client Toast prompt or pop-up prompt, the data structure in the first message can contain the following content:
Figure PCTCN2020107463-appb-000006
Figure PCTCN2020107463-appb-000006
Figure PCTCN2020107463-appb-000007
Figure PCTCN2020107463-appb-000007
步骤406、控制客户端通过监听第一通信接口来接收第一消息,根据第一消息通知第一方法对应的目标执行对象执行相应的操作,并将目标执行对象的执行结果确定为第一处理结果,根据第一处理结果和第一消息中包含的方法标识构造第二消息,通过第二通信接口将第二消息返回至网页端。Step 406: Control the client to receive the first message by listening to the first communication interface, notify the target execution object corresponding to the first method to perform the corresponding operation according to the first message, and determine the execution result of the target execution object as the first processing result , Construct a second message according to the first processing result and the method identifier contained in the first message, and return the second message to the web page through the second communication interface.
在一实施例中,第一处理结果包含于第二消息中的调用结果中。In an embodiment, the first processing result is included in the calling result in the second message.
步骤407、控制客户端查询第二方法列表中是否包含当前需要调用的第二方法,若包含,则构造用于调用第二方法的第四消息,并通过第三通信接口向所述网页端发送第四消息。Step 407: Control the client to query whether the second method list currently needs to be called is included in the second method list, and if it does, construct a fourth message for invoking the second method, and send it to the web page through the third communication interface Fourth news.
步骤408、控制客户端通过第三通信接口向网页端发送用于调用第二方法的第四消息。Step 408: The control client sends a fourth message for invoking the second method to the web page through the third communication interface.
可选的,若检测到网页端中发生网页跳转,则可取出跳转后的当前页面的身份标识,并校验当前页面的身份标识与第二方法列表中的身份标识的区别,若区别仅在于后缀的哈希值不同时,则根据当前页面的身份标识和第二方法列表中的方法,重新构建当前页面对应的方法列表。如前文举例的WKWebView,当WKWebView加载完毕时,可以取出当前页面WebView的URL,并校验该URL与第二方法列表URL之间的区别,若区别仅在于后缀的哈希值不同时,则将当前页面WebView的URL作为key,第二方法列表中的方法作为value,构造当前页面WebView对应的API支持表,之后,当客户端状态发生变化需要通知给网页端时,可以查询当前页面WebView对应的API支持表,选择正确的调用方法以及业务类型等,如以AppBase作为type,再选择identifier和params,构造成消息,通过executeActionInWeb发起调用,从而在网页端中发生页面跳转时,网页端无需重新注册第二方法列表,即可将客户端的状态变化告知网页端的当前页面。Optionally, if it is detected that a web page jump occurs on the web page, the identity of the current page after the jump can be taken out, and the identity of the current page and the identity in the second method list can be checked. If there is a difference Only when the hash values of the suffixes are different, the method list corresponding to the current page is reconstructed according to the identity identifier of the current page and the method in the second method list. Like the WKWebView in the previous example, when WKWebView is loaded, the URL of the current page WebView can be retrieved, and the difference between the URL and the URL of the second method list can be checked. If the difference lies only in the hash value of the suffix, the The URL of the current page WebView is used as the key, and the method in the second method list is used as the value. The API support table corresponding to the current page WebView is constructed. After that, when the client status changes and needs to be notified to the web page, you can query the current page WebView corresponding API support table, select the correct calling method and service type, etc., such as AppBase as the type, and then select identifier and params to construct a message, and initiate a call through executeActionInWeb, so that when a page jump occurs on the web side, the web side does not need to be renewed By registering the second method list, you can notify the current page of the web client of the status change of the client.
步骤409、控制网页端通过监听第三通信接口来接收第四消息,并针对第四消息进行相应的处理,得到第二处理结果,根据第二处理结果和第四消息中包含的方法标识构造第五消息,通过第四通信接口将所述第五消息返回至所述客 户端。Step 409: The control webpage receives the fourth message by monitoring the third communication interface, and performs corresponding processing on the fourth message to obtain the second processing result, and constructs the second processing result according to the second processing result and the method identifier contained in the fourth message. Five messages, the fifth message is returned to the client through the fourth communication interface.
在一实施例中,所述第二处理结果包含于所述第五消息中的调用结果中。In an embodiment, the second processing result is included in the calling result in the fifth message.
本发明实施例提供的通信方法,当客户端或网页端发生更新,如新增对对方的调用时,或者不同业务支持不同类型的调用时,由于在检测到网页端在客户端中启动后,客户端和网页端提前互相通知对方可供调用的方法,因此可以很好地处理多版本多方法兼容性问题,降低产生非预期的调用失败的概率。另外,客户端和网页端可以相互调用,并由调用方设定当前调用的方法标识,方便追踪调用路径,从而规范了客户端和网页端相互之间的方法调用过程。In the communication method provided by the embodiment of the present invention, when the client or the web page is updated, such as when a call to the other party is newly added, or when different services support different types of calls, since the web page is detected to be started in the client, The client and the webpage inform each other of the methods available to call in advance, so the compatibility issues of multiple versions and multiple methods can be handled well, and the probability of unexpected call failures can be reduced. In addition, the client and the web page can call each other, and the caller sets the currently called method identifier to facilitate tracking of the calling path, thereby standardizing the method call process between the client and the web page.
实施例六Example Six
图6为本发明实施例六提供的一种通信装置的结构框图,该装置可由软件和/或硬件实现,可集成在智能终端设备中,可通过通信方法来实现客户端和网页端之间的通信。如图6所示,该装置基于本发明实施例提供的数据结构进行通信,包括:调用发起模块601和调用反馈模块602。Fig. 6 is a structural block diagram of a communication device provided by Embodiment 6 of the present invention. The device can be implemented by software and/or hardware, can be integrated in a smart terminal device, and can realize communication between a client and a webpage through a communication method. Communication. As shown in FIG. 6, the device performs communication based on the data structure provided by the embodiment of the present invention, and includes: a call initiation module 601 and a call feedback module 602.
调用发起模块601,设置为检测到网页端在客户端中启动后,控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息;The call initiation module 601 is set to control the web page to send a first message for invoking the first method to the client through the first communication interface after detecting that the web page is started in the client;
调用反馈模块602,设置为控制所述客户端通过监听所述第一通信接口来接收所述第一消息,并针对所述第一消息进行相应的处理,得到第一处理结果,根据所述第一处理结果和所述第一消息中包含的方法标识构造第二消息,通过第二通信接口将所述第二消息返回至所述网页端,其中,所述第一处理结果包含于所述第二消息中的调用结果中。Call the feedback module 602, set to control the client to receive the first message by listening to the first communication interface, and perform corresponding processing on the first message to obtain the first processing result, and according to the first communication interface A processing result and the method identifier included in the first message construct a second message, and the second message is returned to the web page through a second communication interface, wherein the first processing result is included in the first message The call result in the second message.
本发明实施例中提供的通信装置,应用于客户端与内嵌在客户端中的网页端之间的消息传递,检测到网页端在客户端中启动后,控制网页端通过第一通信接口向客户端发送用于调用第一方法的第一消息,客户端通过监听第一通信接口接收到第一消息后,针对第一消息进行相应的处理,得到第一处理结果,根据第一处理结果和第一消息中包含的方法标识构造第二消息,通过第二通信接口将第二消息返回至网页端,由于在消息传递过程中,第一消息和第二消息中均包含了需要调用的第一方法的针对本次调用的唯一标识,因此,客户端和网页端可以根据该唯一标识对整个调用过程的调用路径进行追踪,从而规范了客户端和网页端之间的通信,有效避免出现通信混乱的问题。The communication device provided in the embodiment of the present invention is applied to message transfer between a client and a webpage embedded in the client. After detecting that the webpage is started in the client, the webpage is controlled to communicate to the client through the first communication interface. The client sends the first message for invoking the first method. After the client receives the first message by monitoring the first communication interface, it performs corresponding processing on the first message to obtain the first processing result, and according to the first processing result and The method identifier contained in the first message constructs the second message, and returns the second message to the web page through the second communication interface. Because in the message transmission process, both the first message and the second message contain the first message that needs to be called. The method is a unique identifier for this call. Therefore, the client and web page can track the call path of the entire call process based on the unique identifier, thereby standardizing the communication between the client and the web page, effectively avoiding communication confusion The problem.
本发明实施例所提供的通信装置可执行本发明实施例所提供的通信方法,具备执行方法相应的功能模块和效果。The communication device provided by the embodiment of the present invention can execute the communication method provided by the embodiment of the present invention, and has functional modules and effects corresponding to the execution method.
实施例七Example Seven
本发明实施例还提供一种包含计算机可执行指令的存储介质,所述计算机 可执行指令在由计算机处理器执行时用于执行本发明实施例提供的通信方法,该方法包括:The embodiment of the present invention also provides a storage medium containing computer-executable instructions, which are used to execute the communication method provided in the embodiment of the present invention when the computer-executable instructions are executed by a computer processor, and the method includes:
检测到网页端在客户端中启动后,控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息;After detecting that the webpage is started in the client, controlling the webpage to send a first message for invoking the first method to the client through the first communication interface;
控制所述客户端通过监听所述第一通信接口来接收所述第一消息,并针对所述第一消息进行相应的处理,得到第一处理结果,根据所述第一处理结果和所述第一消息中包含的方法标识构造第二消息,通过第二通信接口将所述第二消息返回至所述网页端,其中,所述第一处理结果包含于所述第二消息中的调用结果中。Control the client to receive the first message by monitoring the first communication interface, and perform corresponding processing on the first message to obtain a first processing result, and according to the first processing result and the first processing result The method identifier included in a message constructs a second message, and returns the second message to the web page through a second communication interface, wherein the first processing result is included in the calling result in the second message .
本发明实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的通信操作,还可以执行本发明任意相应实施例所提供的通信方法中的相关操作。An embodiment of the present invention provides a storage medium containing computer-executable instructions. The computer-executable instructions are not limited to the above-mentioned communication operations, and can also perform related operations in the communication method provided in any corresponding embodiment of the present invention. .
实施例八Example eight
本发明实施例提供了一种智能终端设备,该设备集成本发明实施例提供的通信装置。图7为本发明实施例八提供的一种智能终端设备的结构框图。智能终端设备700包括存储器701、处理器702及存储在存储器701上并可在处理器702上运行的计算机程序,所述处理器702执行所述计算机程序时实现本发明实施例提供的通信方法。该方法包括:The embodiment of the present invention provides an intelligent terminal device, which integrates the communication device provided in the embodiment of the present invention. FIG. 7 is a structural block diagram of an intelligent terminal device provided by Embodiment 8 of the present invention. The intelligent terminal device 700 includes a memory 701, a processor 702, and a computer program that is stored on the memory 701 and can run on the processor 702. The processor 702 implements the communication method provided by the embodiment of the present invention when the computer program is executed. The method includes:
检测到网页端在客户端中启动后,控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息;After detecting that the webpage is started in the client, controlling the webpage to send a first message for invoking the first method to the client through the first communication interface;
控制所述客户端通过监听所述第一通信接口来接收所述第一消息,并针对所述第一消息进行相应的处理,得到第一处理结果,根据所述第一处理结果和所述第一消息中包含的方法标识构造第二消息,通过第二通信接口将所述第二消息返回至所述网页端,其中,所述第一处理结果包含于所述第二消息中的调用结果中。Control the client to receive the first message by monitoring the first communication interface, and perform corresponding processing on the first message to obtain a first processing result, and according to the first processing result and the first processing result The method identifier included in a message constructs a second message, and returns the second message to the web page through a second communication interface, wherein the first processing result is included in the calling result in the second message .
本发明实施例中提供的智能终端设备,客户端和网页端可以根据该唯一标识对整个调用过程的调用路径进行追踪,从而规范了客户端和网页端之间的通信,有效避免出现通信混乱的问题。In the smart terminal device provided in the embodiment of the present invention, the client and the web page can track the call path of the entire calling process according to the unique identifier, thereby standardizing the communication between the client and the web page, and effectively avoiding communication confusion. problem.
上述实施例中提供的通信装置、存储介质以及智能终端设备可执行本发明任意实施例所提供的通信方法,具备执行该方法相应的功能模块和效果。未在上述实施例中描述的技术细节,可参见本发明任意实施例所提供的通信方法。The communication device, storage medium, and smart terminal device provided in the foregoing embodiments can execute the communication method provided in any embodiment of the present invention, and have the corresponding functional modules and effects for executing the method. For technical details not described in the foregoing embodiment, reference may be made to the communication method provided in any embodiment of the present invention.

Claims (16)

  1. 一种数据结构,应用于客户端与网页端之间的消息传递,所述网页端嵌入到所述客户端内并与本地层进行交互,所述数据结构包括:A data structure applied to message transfer between a client and a web page, where the web page is embedded in the client and interacts with a local layer, and the data structure includes:
    调用方法,用于表示请求调用的方法;Call method, used to indicate the method requested to be called;
    方法标识,用于表示所述调用方法的本次调用对应的唯一标识,所述方法标识在用于请求调用的消息中和用于反馈调用结果的消息中保持一致;The method identifier is used to indicate the unique identifier corresponding to this invocation of the method invoking, and the method identifier is consistent in the message used to request the invocation and the message used to feedback the invocation result;
    调用参数,用于表示所述调用方法的本次调用对应的参数。The call parameter is used to indicate the parameter corresponding to this call of the call method.
  2. 根据权利要求1所述的数据结构,其中,在所述数据结构存在于所述用于反馈调用结果的消息中的情况下,所述数据结构还包括调用结果。The data structure according to claim 1, wherein, in a case where the data structure exists in the message for feeding back the call result, the data structure further includes the call result.
  3. 根据权利要求1所述的数据结构,其中,所述数据结构中还包括业务类型,所述业务类型用于表示所述调用方法对应的业务种类。The data structure according to claim 1, wherein the data structure further includes a service type, and the service type is used to indicate a service type corresponding to the calling method.
  4. 一种通信方法,基于如权利要求1至3中任一项所述的数据结构进行通信,包括:A communication method for communicating based on the data structure according to any one of claims 1 to 3, comprising:
    检测到网页端在客户端中启动后,控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息;After detecting that the webpage is started in the client, controlling the webpage to send a first message for invoking the first method to the client through the first communication interface;
    控制所述客户端通过监听所述第一通信接口来接收所述第一消息,并针对所述第一消息进行相应的处理,得到第一处理结果,根据所述第一处理结果和所述第一消息中包含的方法标识构造第二消息,通过第二通信接口将所述第二消息返回至所述网页端,其中,所述第一处理结果包含于所述第二消息中的调用结果中。Control the client to receive the first message by monitoring the first communication interface, and perform corresponding processing on the first message to obtain a first processing result, and according to the first processing result and the first processing result The method identifier included in a message constructs a second message, and returns the second message to the web page through a second communication interface, wherein the first processing result is included in the calling result in the second message .
  5. 根据权利要求4所述的方法,其中,所述针对所述第一消息进行相应的处理,包括:The method according to claim 4, wherein the corresponding processing for the first message comprises:
    根据所述第一消息通知所述第一方法对应的目标执行对象执行相应的操作,并将所述目标执行对象的执行结果确定为所述第一处理结果。According to the first message, the target execution object corresponding to the first method is notified to perform a corresponding operation, and the execution result of the target execution object is determined as the first processing result.
  6. 根据权利要求4所述的方法,其中,在所述控制所述客户端通过监听所述第一通信接口来接收所述第一消息之后,还包括:The method according to claim 4, wherein after the controlling the client to receive the first message by listening to the first communication interface, the method further comprises:
    在确定本地层不允许调用所述第一方法的情况下,根据所述第一消息中包含的方法标识构造第三消息,将所述第三消息通过所述第二通信接口返回至所述网页端,所述第三消息中的调用结果中包含错误信息。In the case where it is determined that the local layer does not allow the calling of the first method, a third message is constructed according to the method identifier contained in the first message, and the third message is returned to the web page through the second communication interface At the end, the call result in the third message contains error information.
  7. 根据权利要求4所述的方法,其中,在所述检测到网页端在客户端中启动后,还包括:The method according to claim 4, wherein, after the detecting that the webpage terminal is started in the client terminal, the method further comprises:
    控制所述客户端向所述网页端注册所述第一通信接口和所述第二通信接 口。Control the client to register the first communication interface and the second communication interface with the web page.
  8. 根据权利要求7所述的方法,其中,所述控制所述客户端向所述网页端注册所述第一通信接口和所述第二通信接口,包括:8. The method according to claim 7, wherein said controlling said client to register said first communication interface and said second communication interface with said webpage terminal comprises:
    获取所述网页端的当前网页的身份标识;Acquiring the identity identifier of the current webpage on the webpage side;
    根据所述身份标识查询预设授权信息,在根据查询结果确定所述当前网页为已授权状态的情况下,控制所述客户端向所述网页端注册所述第一通信接口和所述第二通信接口。Query preset authorization information according to the identity identifier, and if the current web page is determined to be in an authorized state according to the query result, control the client to register the first communication interface and the second communication interface with the web page. Communication Interface.
  9. 根据权利要求7所述的方法,其中,在所述控制所述客户端向所述网页端注册所述第一通信接口之后,还包括:8. The method according to claim 7, wherein after the controlling the client to register the first communication interface with the web page, the method further comprises:
    控制所述客户端向所述网页端注册本地层允许所述网页端的当前网页进行调用的方法,得到第一方法列表。Control the client to register the local layer with the web page to allow the method to call the current web page of the web page, and obtain the first method list.
  10. 根据权利要求9所述的方法,其中,所述控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息,包括:The method according to claim 9, wherein the controlling the web page to send the first message for invoking the first method to the client via the first communication interface comprises:
    控制所述网页端查询所述第一方法列表中是否包含当前需要调用的第一方法,在所述第一方法列表中包含当前需要调用的第一方法的情况下,构造用于调用所述第一方法的第一消息,并通过所述第一通信接口向所述客户端发送所述第一消息。Control the web page to query whether the first method list contains the first method that needs to be called currently, and in the case that the first method list contains the first method that needs to be called currently, construct a method for calling the first method And send the first message to the client through the first communication interface.
  11. 根据权利要求7所述的方法,其中,在所述检测到网页端在客户端中启动后,还包括:8. The method according to claim 7, wherein, after the detecting that the webpage terminal is started in the client terminal, the method further comprises:
    控制所述客户端通过第三通信接口向所述网页端发送用于调用第二方法的第四消息;Controlling the client to send a fourth message for invoking the second method to the web page through a third communication interface;
    控制所述网页端通过监听所述第三通信接口来接收所述第四消息,并针对所述第四消息进行相应的处理,得到第二处理结果,根据所述第二处理结果和所述第四消息中包含的方法标识构造第五消息,通过第四通信接口将所述第五消息返回至所述客户端,其中,所述第二处理结果包含于所述第五消息中的调用结果中。Control the web page to receive the fourth message by monitoring the third communication interface, and perform corresponding processing on the fourth message to obtain a second processing result, and according to the second processing result and the first processing result Fourth, the method identifier contained in the message constructs a fifth message, and returns the fifth message to the client through a fourth communication interface, wherein the second processing result is included in the call result in the fifth message .
  12. 根据权利要求11所述的方法,其中,在所述控制所述客户端向所述网页端注册所述第一通信接口之后,还包括:The method according to claim 11, wherein after the controlling the client to register the first communication interface with the web page, the method further comprises:
    控制所述网页端构造第六消息,并通过所述第一通信接口向所述客户端发送所述第六消息,以实现向所述客户端注册所述网页端的当前页面支持所述客户端调用的方法,其中,所述第六消息中的调用方法为本地层提供的注册方法,所述第六消息中的调用参数包括所述网页端的当前页面支持所述客户端调用的 方法;Control the web page to construct a sixth message, and send the sixth message to the client through the first communication interface, so as to register the current page of the web page with the client to support the client call , Wherein the calling method in the sixth message is a registration method provided by the local layer, and the calling parameter in the sixth message includes a method that the current page of the web page supports the client to call;
    控制所述客户端根据所述第六消息生成第二方法列表。Controlling the client to generate a second method list according to the sixth message.
  13. 根据权利要求12所述的方法,其中,所述控制所述客户端通过调用第三通信接口向所述网页端发送用于调用第二方法的第四消息,包括:The method according to claim 12, wherein said controlling said client to send a fourth message for invoking the second method to said web page by invoking a third communication interface comprises:
    控制所述客户端查询所述第二方法列表中是否包含当前需要调用的第二方法,在所述第二方法列表中包含当前需要调用的第二方法的情况下,构造用于调用所述第二方法的第四消息,并通过所述第三通信接口向所述网页端发送所述第四消息。Control the client to query whether the second method list contains the second method that needs to be called currently, and when the second method list contains the second method that needs to be called currently, construct a method for calling the first method. The fourth message of the second method, and send the fourth message to the web page through the third communication interface.
  14. 一种通信装置,基于如权利要求1至3中任一项所述的数据结构进行通信,包括:A communication device for communicating based on the data structure according to any one of claims 1 to 3, comprising:
    调用发起模块,设置为检测到网页端在客户端中启动后,控制所述网页端通过第一通信接口向所述客户端发送用于调用第一方法的第一消息;A call initiation module configured to control the web page to send a first message for invoking the first method to the client through the first communication interface after detecting that the web page is started in the client;
    调用反馈模块,设置为控制所述客户端通过监听所述第一通信接口来接收所述第一消息,并针对所述第一消息进行相应的处理,得到第一处理结果,根据所述第一处理结果和所述第一消息中包含的方法标识构造第二消息,通过第二通信接口将所述第二消息返回至所述网页端,其中,所述第一处理结果包含于所述第二消息中的调用结果中。Call the feedback module, set to control the client to receive the first message by listening to the first communication interface, and perform corresponding processing on the first message to obtain a first processing result, according to the first The processing result and the method identifier included in the first message construct a second message, and the second message is returned to the web page through a second communication interface, wherein the first processing result is included in the second In the call result in the message.
  15. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求4-13中任一项所述的通信方法。A computer-readable storage medium that stores a computer program, and when the computer program is executed by a processor, the communication method according to any one of claims 4-13 is realized.
  16. 一种智能终端设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求4-13任一项所述的通信方法。An intelligent terminal device, comprising a memory, a processor, and a computer program stored on the memory and capable of running on the processor. The processor executes the computer program to implement any one of claims 4-13. The communication method described in the item.
PCT/CN2020/107463 2019-11-29 2020-08-06 Data structure, communication method and apparatus, storage medium and device WO2021103644A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911207484.6 2019-11-29
CN201911207484.6A CN110990170A (en) 2019-11-29 2019-11-29 Data structure, communication method, device, storage medium and equipment

Publications (1)

Publication Number Publication Date
WO2021103644A1 true WO2021103644A1 (en) 2021-06-03

Family

ID=70088774

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/107463 WO2021103644A1 (en) 2019-11-29 2020-08-06 Data structure, communication method and apparatus, storage medium and device

Country Status (2)

Country Link
CN (1) CN110990170A (en)
WO (1) WO2021103644A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990170A (en) * 2019-11-29 2020-04-10 广州市百果园信息技术有限公司 Data structure, communication method, device, storage medium and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030167356A1 (en) * 2001-07-10 2003-09-04 Smith Adam W. Application program interface for network software platform
CN104375831A (en) * 2014-11-06 2015-02-25 北京奇虎科技有限公司 Method, device and system realizing communication between webpage and applications on terminal equipment
CN107015870A (en) * 2016-09-19 2017-08-04 阿里巴巴集团控股有限公司 Realize method, device and the electronic equipment of web page and locally applied communication
CN108733377A (en) * 2018-05-14 2018-11-02 广东蜂助手网络技术股份有限公司 The JS exchange methods of page end and mobile phone terminal in a kind of App
CN110990170A (en) * 2019-11-29 2020-04-10 广州市百果园信息技术有限公司 Data structure, communication method, device, storage medium and equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123353B (en) * 2014-07-14 2017-11-28 可牛网络技术(北京)有限公司 A kind of method and system for improving browser security
CN105867984B (en) * 2016-04-22 2017-09-05 广州阿里巴巴文学信息技术有限公司 The method of show task status, device, client and mobile device in webpage
CN106843975B (en) * 2017-01-24 2020-10-20 深圳创维-Rgb电子有限公司 Method and device for extending HTML5 application function
CN107222543B (en) * 2017-06-14 2020-06-05 北京掌上时惠科技有限公司 Mobile APP and Web page communication method and system
CN109062626A (en) * 2018-07-09 2018-12-21 北京奇艺世纪科技有限公司 Exchange method, device and the equipment of Web page component and Native component

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030167356A1 (en) * 2001-07-10 2003-09-04 Smith Adam W. Application program interface for network software platform
CN104375831A (en) * 2014-11-06 2015-02-25 北京奇虎科技有限公司 Method, device and system realizing communication between webpage and applications on terminal equipment
CN107015870A (en) * 2016-09-19 2017-08-04 阿里巴巴集团控股有限公司 Realize method, device and the electronic equipment of web page and locally applied communication
CN108733377A (en) * 2018-05-14 2018-11-02 广东蜂助手网络技术股份有限公司 The JS exchange methods of page end and mobile phone terminal in a kind of App
CN110990170A (en) * 2019-11-29 2020-04-10 广州市百果园信息技术有限公司 Data structure, communication method, device, storage medium and equipment

Also Published As

Publication number Publication date
CN110990170A (en) 2020-04-10

Similar Documents

Publication Publication Date Title
US11921996B2 (en) Information processing terminal and control method
US8769125B2 (en) Method and apparatus for ensuring transport of user agent information
WO2016127793A1 (en) Message sending method, apparatus, system, and server
CN108833585B (en) Information interaction method and device and storage medium
CN104580085B (en) service data updating method, system, client and server
CN104102537A (en) Application calling method and user terminal
US20120150808A1 (en) Method and system for performing data backup and restoration
US20140089383A1 (en) Method and system for automatic detecting and resolving apis
CN107682426B (en) Interface proxy method and application server
CN111756674A (en) Network communication method, system, device and computer readable storage medium
CN111258723B (en) Transaction processing method, device, system, medium and equipment of distributed system
CN108966159B (en) Short message withdrawing method, system, computer equipment and storage medium
CN104348848A (en) Method, terminal equipment and server for managing pictures
WO2021103644A1 (en) Data structure, communication method and apparatus, storage medium and device
WO2022262397A1 (en) Interface display method and electronic device
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium
CN113821333A (en) Android application program migration method and device
US8280943B1 (en) Managing service provider messaging
CN109639629B (en) Data access processing method and device, computer equipment and storage medium
CN111338898B (en) Application state acquisition method and device, electronic equipment and readable storage medium
CN113810535B (en) Information processing method and electronic device
US9332374B2 (en) Communication interface method for SE equipped on mobile terminal and SE using the same
US9544426B2 (en) Method for transmitting data related to a call
CN110545527A (en) call forwarding method, video communication server and calling terminal
CN110928598A (en) System configuration method, device, computer equipment and storage medium

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: 20894044

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: 20894044

Country of ref document: EP

Kind code of ref document: A1