CN108965413B - Information interaction method and device and storage medium - Google Patents

Information interaction method and device and storage medium Download PDF

Info

Publication number
CN108965413B
CN108965413B CN201810718210.2A CN201810718210A CN108965413B CN 108965413 B CN108965413 B CN 108965413B CN 201810718210 A CN201810718210 A CN 201810718210A CN 108965413 B CN108965413 B CN 108965413B
Authority
CN
China
Prior art keywords
event
operating system
target
request
webpage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810718210.2A
Other languages
Chinese (zh)
Other versions
CN108965413A (en
Inventor
陈顺
董红光
董俊杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201810718210.2A priority Critical patent/CN108965413B/en
Publication of CN108965413A publication Critical patent/CN108965413A/en
Application granted granted Critical
Publication of CN108965413B publication Critical patent/CN108965413B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

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

Abstract

The disclosure relates to an information interaction method, an information interaction device and a storage medium, and relates to the technical field of data processing. The method comprises the following steps: the operating system receives an event request from the webpage through a data channel established between the operating system and the webpage, wherein the event request is used for indicating a target event requested by the webpage from the operating system, the operating system acquires an event result of the target event, and the operating system feeds back the event result of the target event to the webpage through the data channel. The embodiment of the disclosure realizes the interaction between the webpage and the operating system, and increases the information interaction function of the webpage.

Description

Information interaction method and device and storage medium
Technical Field
The disclosed embodiments relate to the field of network technologies, and in particular, to an information interaction method, an information interaction device, and a storage medium.
Background
At present, with the rapid development of network technologies, web pages not only can provide browsing contents for users, but also have more and more functions. In the related art, how a webpage can realize more information interaction becomes a research hotspot.
Disclosure of Invention
The embodiment of the disclosure provides an information interaction method, an information interaction device and a storage medium, which can solve the problem of how to realize more information interaction on a webpage.
According to a first aspect of the embodiments of the present disclosure, there is provided an information interaction method, the method including:
an operating system receives an event request from a webpage through a data channel established between the operating system and the webpage, wherein the event request is used for indicating a target event requested by the webpage to the operating system;
the operating system acquires an event result of the target event;
and the operating system feeds back the event result of the target event to the webpage through the data channel.
Optionally, the obtaining, by the operating system, an event result of the target event includes:
the operating system determining an event type of the target event;
and the operating system acquires an event result of the target event according to the event type of the target event.
Optionally, the obtaining, by the operating system, an event result of the target event according to the event type of the target event includes:
when the event type belongs to an instant event type, the operating system acquires an event result of the target event;
or,
and when the event type belongs to the monitoring event type, the operating system acquires the event result of the target event once every preset time interval.
Optionally, the determining, by the operating system, an event type of the target event includes:
when the event request comprises the event type of the target event, the operating system acquires the event type of the target event from the event request; or,
when the event request comprises a target interface identifier corresponding to the target event, the operating system acquires an event type corresponding to the target interface identifier from a pre-stored corresponding relationship, and determines the acquired event type as the event type of the target event, wherein the corresponding relationship comprises a corresponding relationship between at least one group of interface identifiers and the event type, and the interface identifiers are used for identifying interfaces corresponding to the requested event.
Optionally, the operating system feeds back the event result of the target event to the web page through the data channel, including:
and when the data quantity of the event result of the target event is larger than a preset threshold value, compressing the event result, and feeding back the compressed event result to the webpage through the data channel.
Optionally, after receiving the event request from the web page, the operating system invokes a specified service program, where the specified service program is used to obtain an event result of the target event.
Optionally, before the operating system receives an event request from a web page through a data channel established with the web page, the method further includes:
the operating system establishes long connection with a server, and the server is used for establishing a data channel between the operating system and the webpage;
accordingly, the operating system receives an event request from a web page, including:
and the operating system receives the event request from the webpage forwarded by the server through the long connection established between the operating system and the server.
Optionally, the receiving, by the operating system, an event request from the web page through a data channel established with the web page includes:
the operating system acquires the event request from the webpage from a clipboard, wherein the event request is request information which is sent to the clipboard by the webpage and can be identified by the operating system and has a preset format, and the clipboard is used for establishing a data channel between the operating system and the webpage.
According to a second aspect of the embodiments of the present disclosure, there is provided an information interaction apparatus configured in an operating system, the apparatus including:
the receiving module is configured to receive an event request from a webpage through a data channel established between the receiving module and the webpage, wherein the event request is used for indicating a target event requested by the webpage from the operating system;
an acquisition module configured to acquire an event result of the target event;
a feedback module configured to feed back an event result of the target event to the web page through the data channel.
Optionally, the obtaining module includes:
a determination submodule configured to determine an event type of the target event;
and the acquisition sub-module is configured to acquire an event result of the target event according to the event type of the target event.
Optionally, the obtaining sub-module is configured to:
when the event type belongs to an instant event type, the operating system acquires an event result of the target event;
or,
and when the event type belongs to the monitoring event type, the operating system acquires the event result of the target event once every preset time interval.
Optionally, the determining sub-module is configured to:
when the event request comprises the event type of the target event, the operating system acquires the event type of the target event from the event request; or,
when the event request comprises a target interface identifier corresponding to the target event, the operating system acquires an event type corresponding to the target interface identifier from a pre-stored corresponding relationship, and determines the acquired event type as the event type of the target event, wherein the corresponding relationship comprises a corresponding relationship between at least one group of interface identifiers and the event type, and the interface identifiers are used for identifying interfaces corresponding to the requested event.
Optionally, the feedback module is configured to:
and when the data quantity of the event result of the target event is larger than a preset threshold value, compressing the event result, and feeding back the compressed event result to the webpage through the data channel.
Optionally, the apparatus further comprises:
and the calling module is configured to call a specified service program, and the specified service program is used for acquiring the event result of the target event.
Optionally, the apparatus further comprises:
the establishing module is configured to establish a long connection with a server, and the server is used for establishing a data channel between the operating system and the webpage;
the receiving module is configured to: and receiving the event request from the webpage forwarded by the server through the long connection established between the server and the server.
Optionally, the obtaining module is further configured to:
and acquiring the event request from the webpage from a clipboard, wherein the event request is request information which is sent to the clipboard by the webpage and has a preset format and can be identified by the operating system, and the clipboard is used for establishing a data channel between the operating system and the webpage.
According to a third aspect of the embodiments of the present disclosure, there is provided an information interaction apparatus, the apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute the information interaction method of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the information interaction method of the first aspect described above.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product containing instructions, which when run on a computer, causes the computer to execute the information interaction method of the first aspect.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
the operating system receives the event request from the webpage through a data channel established between the operating system and the webpage, acquires an event result aiming at the event request, and then feeds the acquired event result back to the webpage, so that interaction between the webpage and the operating system is realized, and the information interaction function of the webpage is increased.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a schematic diagram of an implementation environment shown in accordance with an exemplary embodiment;
FIG. 2 is a flow diagram illustrating a method of information interaction in accordance with an exemplary embodiment;
FIG. 3 is a block diagram illustrating an information interaction device, according to an example embodiment;
FIG. 4 is a block diagram illustrating an information interaction device, according to another example embodiment;
fig. 5 is a block diagram illustrating an information interaction device, according to another example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure.
Before describing the information interaction method provided by the embodiment of the present disclosure in detail, a brief description is first given to an application scenario and an implementation environment related to the embodiment of the present disclosure.
First, a brief description is given of an application scenario related to an embodiment of the present disclosure.
At present, with the rapid development of network technology, more and more functions can be carried by web pages. For example, a web page needs to interact with an operating system, that is, during the web page display process, some information may need to be acquired from the operating system of the mobile terminal, so that the web page is loaded and displayed according to the acquired information. Therefore, in this embodiment, a method for implementing information interaction between a web page and an operating system is studied, and for specific implementation, reference is made to the embodiment shown in fig. 2 below.
Next, a brief description is given of an implementation environment related to the embodiments of the present disclosure.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an implementation environment according to an exemplary embodiment, where the implementation environment mainly includes a mobile terminal 110 and a server 120, and a long connection is established between an operating system of the mobile terminal 110 and the server 120.
The mobile terminal 110 is mainly used for implementing the information interaction method provided by the embodiment of the present disclosure, here, the mobile terminal 110 implements the information interaction method through an operating system, where the operating system may include, but is not limited to, an android operating system, an IOS operating system, or another operating system that is customized and developed based on the android operating system.
The server 120 is mainly used for establishing communication between the operating system of the mobile terminal 110 and a web page. At present, for the security of the operating system, only the browser and the software including the browser kernel can access the web page, that is, information interaction is performed between the browser and the web page, and in the interaction process, the browser and other software create an independent execution environment for the web page, so that the web page and the operating system of the mobile terminal cannot be directly interacted. Therefore, in order to realize the interaction between the operating system and the web page, a data channel needs to be established between the operating system of the mobile terminal 110 and the web page through the server 120 for realizing the communication.
To this end, a long connection needs to be established between the operating system of the mobile terminal 110 and the server 120, and in one possible implementation, the long connection between the server 120 and the operating system of the mobile terminal 110 may be a long connection that the operating system of the mobile terminal 110 establishes with the server 120 when detecting that the web page starts running. Alternatively, it may be a long connection established by the operating system of the mobile terminal 110 with the server 120 upon completion of the booting. The long connection may be a TCP (Transmission Control Protocol) connection. That is, the operating system of mobile terminal 110 may send a connection request to server 120 when the operating system of mobile terminal 110 is started or when a web page in mobile terminal 110 starts running. When the server 120 receives the connection request, a long connection is established with the operating system of the mobile terminal 110.
Further, since the server 120 may have long connections established with the operating systems of a plurality of mobile terminals, the server 120 may assign a connection identification to each long connection in order to distinguish the long connection between the server 120 and the operating system of each mobile terminal. That is, after the server 120 establishes a long connection with the operating system of the mobile terminal 110, the long connection may be assigned a connection identifier for uniquely identifying the long connection. Further, after the server 120 assigns the connection identifier for the established long connection, in order to associate each mobile terminal with the corresponding long connection, the server 120 can find the long connection corresponding to the mobile terminal 110 when receiving the event request of the mobile terminal 110 later. The server 120 may determine a Media Access Control (MAC) address of the mobile terminal 110 according to a connection request sent by an operating system of the mobile terminal 110, and further store the MAC address of the mobile terminal 110 and a connection identifier of the established long connection in a mapping relationship. Wherein, the mapping relation includes MAC addresses of a plurality of mobile terminals and corresponding connection identifiers. Thus, the server 120 can implement information interaction between the operating system and the web page based on the mapping relationship.
In some embodiments, the server 120 may provide multiple types of services at the same time, and therefore, in order to distinguish different connections corresponding to different services, the operating system of the mobile terminal 110 may further send a service registration request to the server 120 after establishing a long connection with the server 120, where the service registration request carries a service name. After the server 120 receives the service registration request, it may register the service name based on the service registration request, and store the service name, the MAC address of the mobile terminal 110, and the connection identifier of the established long connection in a mapping relationship, where the mapping relationship is a mapping relationship among the service name, the MAC address, and the connection identifier. Thus, the server 120 can also implement information interaction between the operating system and the web page based on the mapping relationship.
In some embodiments, the server 120 generally refers to a web server serving a web page, and may be one server, or a server cluster composed of several servers, or one cloud computing service center, which is not limited in this disclosure.
After the application scenarios and the implementation environments related to the embodiments of the present disclosure are described, the information interaction method related to the embodiments of the present disclosure will be described in detail with reference to the drawings.
Fig. 2 is a flowchart illustrating an information interaction method according to an exemplary embodiment, where the information interaction method is applied to the above implementation environment, and the information interaction method may include the following implementation steps:
in step 201, the operating system receives an event request from a web page through a data channel established between the web page and the operating system, where the event request is used to indicate a target event requested by the web page from the operating system.
As described above, since a data channel is established between the operating system and the web page, the operating system can receive an event request from the web page through the data channel established with the web page.
For example, the operating system establishes a long connection with a server for enabling communication between the operating system and the web page, and receives an event request from the web page forwarded by the server through the long connection established with the server.
In the implementation process, a DNS address may be configured in the server in advance, and when the web page needs to perform information interaction with the operating system of the mobile terminal, the DNS address of the configured server may be automatically acquired, and the event request may be sent to the server according to the DNS address. When the server receives the event request, the event request is transmitted to the operating system of the mobile terminal through a long connection with the operating system of the mobile terminal.
Based on the foregoing, in a possible implementation manner, after the server establishes the long connection with the operating system of the mobile terminal in the above manner, if the server stores the MAC address of the mobile terminal and the connection identifier of the established long connection in the mapping relationship, since the mapping relationship does not have a service name, the web page of the mobile terminal is not configured with the service name, and thus, the event request sent by the web page of the mobile terminal to the server does not include the service name. In this case, when the server receives the event request, since the server establishes long connections with the plurality of mobile terminals, the server may determine a long connection with the operating system of the mobile terminal from among the plurality of long connections according to the event request, and transmit the event request to the operating system of the mobile terminal through the determined long connection.
In another possible implementation manner, after the server establishes the long connection with the operating system of the mobile terminal in the above manner, if the server stores the service name, the MAC address of the mobile terminal, and the connection identifier of the established long connection in a mapping relationship according to a received service registration request sent by the operating system of the mobile terminal, then the service name exists in the mapping relationship, and therefore, the service name is also configured in the web page of the mobile terminal, and thus, when the web page of the mobile terminal needs to perform information interaction with the operating system to send an event request to the server, the event request includes the service name. In this case, the server may determine a long connection with the operating system of the mobile terminal from among a plurality of long connections according to the event request when receiving the event request, and thus transmit the event request to the operating system of the mobile terminal through the determined long connection.
It should be noted that, here, the long connection between the operating system and the server is established, and the data channel between the operating system and the web page is established as an example, in some embodiments, the data channel between the operating system and the web page may also be established in other manners. For example, the data channel may be established through a clipboard, and at this time, the web page may preprocess the event request, convert the event request into an event request in a preset format that can be recognized by the operating system, and then send the event request to the clipboard of the mobile terminal. At this time, the operating system obtains an event request from the web page from a clipboard, where the event request is request information in a preset format that can be recognized by the operating system and is sent by the web page to the clipboard, and the clipboard is used to implement communication between the operating system and the web page.
In addition, in addition to the above implementation, a data channel between the operating system and the web page may be established in other ways. For example, since software such as a browser can interact information with a web page, the data channel can be established by means of a browser component, so as to interact the web page with an operating system. In some embodiments, the web page may send the event request to a preset domain name, where the preset domain name may be set in advance, and when the mobile terminal receives the event request sent by the web page to the preset domain name through the browser component, the preset domain name is resolved into an assigned access address, and the event request is sent with the assigned access address as a target address. When the target address of the event request is detected to be the designated access address through the firewall, the event request is redirected to a local webpage service, and the operating system acquires the event request from the local webpage service. The local webpage service is used for carrying out information interaction with the terminal operating system.
It is worth mentioning that when the mobile terminal receives an event request sent by a webpage to a preset domain name, the mobile terminal redirects a target address of the event request to a local webpage service capable of interacting with a terminal operating system through a firewall, and the local webpage service completes the interaction with the terminal operating system, so that the limit of the interaction function of a browser and the operating system can be avoided, the development cost is low, and the universality is high.
Of course, in some embodiments, other ways may also be used to establish the data channel between the operating system and the web page, and embodiments of the present disclosure are not described in detail.
In step 202, the operating system obtains event results for the target event.
In one possible implementation, the implementation of the operating system to obtain the event result of the target event may include: the operating system determines the event type of the target event, and the operating system acquires the event result of the target event according to the event type of the target event.
When the event types of the target event are different, the operating system may obtain the event result of the target event in different manners, and therefore, in the implementation process, the event type of the target event may be determined. In some embodiments, the determining, by the operating system, the event type of the target event may include any one of the following implementations:
the first implementation mode comprises the following steps: when the event request includes the event type of the target event, the operating system obtains the event type of the target event from the event request.
That is, before the web page sends the event request, the event type of the target event to be requested is determined, and the determined event type is packaged into the event request. And after receiving the event request from the webpage, the operating system analyzes the event request to acquire the event type of the target event.
The second implementation mode comprises the following steps: when the event request includes a target interface identifier corresponding to the target event, the operating system acquires an event type corresponding to the target interface identifier from a pre-stored corresponding relationship, and determines the acquired event type as the event type of the target event, wherein the corresponding relationship includes a corresponding relationship between at least one group of interface identifiers and the event type, and the interface identifiers are used for identifying interfaces corresponding to the requested event.
In this implementation manner, the web page may carry a target interface identifier in the request event, where the target interface identifier may be used to identify an interface corresponding to the event to be requested by the web page, for example, the target interface identifier may be an address book interface identifier. And, the mobile terminal stores the corresponding relation between at least one group of interface identification and the event type in advance.
Thus, after receiving the event request, the operating system parses the event request to obtain the target interface identifier, and determines which type of the event requested by the web page belongs to from the stored corresponding relationship according to the target interface identifier. Wherein, the instant event type refers to an event type of an event that can complete a feedback operation in a short time at once.
After determining the event type of the target event, the operating system may obtain an event result of the target event according to different implementation manners according to the event type of the target event. In some embodiments, the operating system obtaining the event result of the target event according to the event type of the target event may include any one of the following implementation manners:
the first implementation mode comprises the following steps: and when the event type belongs to the instant event type, the operating system acquires an event result of the target event.
If the event type is an instant event type, the operating system can obtain the time result of the target event at one time. For example, if the target event is to obtain contact information, and the target event belongs to the instant event type, the operating system obtains the contact information at one time.
The second implementation mode comprises the following steps: and when the event type belongs to the monitoring event type, the operating system acquires the event result of the target event at preset time intervals.
The monitoring event type refers to an event type of an event that needs to be periodically monitored, for example, when the target event is a monitoring network state, the event type of the target event belongs to the monitoring event type. At this time, the operating system needs to acquire the network state once every preset time interval, so that the purpose of monitoring can be achieved.
The preset time interval can be set by a user according to actual requirements in a self-defined mode, and can also be set by the mobile terminal in a default mode. In addition, the preset time intervals of two adjacent times may be the same or different, and this is not limited in this disclosure.
Further, the operating system calls a specified service program, and the specified service program is used for acquiring the event result of the target event.
The specified service program may be configured inside the operating system. That is, after receiving the event request from the web page through the data channel, the operating system may call the designated service program to perform an operation of obtaining an event result of the target event through the service program.
It is worth mentioning that the event result of the target event is obtained by calling the specified service program, so that the operation is modularized, and convenience is provided for the function management of the operating system.
In step 203, the operating system feeds back the event result of the target event to the web page through a data channel.
For example, if the data channel is established through a server, the operating system sends the event result of the target event to the server, and the server receives the event result and forwards the event result to the web page, thereby implementing the operation of feeding back the event result of the target event to the web page.
Further, when the event type of the target event belongs to the monitoring event type, the operating system feeds back the event result of the target event to the webpage through the data channel every time the operating system acquires the event result of the target event.
In the implementation process, the operating system may feed back the event result of the target event to the web page in the form of a data packet.
In one possible implementation, the step 203 includes: and when the data volume of the event result of the target event is larger than a preset threshold value, compressing the event result, and feeding back the compressed event result to the webpage through a data channel.
The preset threshold may be set by a user according to actual requirements in a self-defined manner, or may be set by the mobile terminal in a default manner, which is not limited in the embodiment of the present invention.
In order to save network traffic and improve feedback speed, when the data volume of the event result of the target event is greater than a preset threshold, the operating system may compress the event result, so that the data volume of the event result is reduced, and then, the operating system feeds back the compressed event result to the web page through the data channel.
In some embodiments, the operating system may perform compression processing on the event result according to a compression ratio threshold, where the compression ratio threshold may be set by a user in a customized manner according to actual needs, or may be set by the mobile terminal in a default manner, which is not limited in this disclosure.
Of course, if the data size of the event result of the target event is smaller than the preset threshold, the operating system may directly feed back the acquired event result of the target event to the web page.
It should be noted that, when the data amount of the event result of the target event is greater than the preset threshold, the above is only described by taking the operating system as an example to compress the event result, in some embodiments, if the event result is obtained by the operating system from an application in the mobile terminal, the event result may also be compressed by the application, and then, the compressed event result is sent to the operating system, and the operating system feeds back the event result after the application compression processing to the web page through the data channel.
In the embodiment of the disclosure, the operating system receives the event request from the web page through the data channel established between the operating system and the web page, and the operating system acquires the event result according to the event request and then feeds back the acquired event result to the web page, so that the interaction between the web page and the operating system is realized, and the information interaction function of the web page is increased.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods. For details not disclosed in the embodiments of the apparatus of the present disclosure, refer to the embodiments of the method of the present disclosure.
FIG. 3 is a block diagram illustrating an information interaction device, according to an example embodiment. The apparatus has functions of implementing the above method examples, and the functions may be implemented by hardware or hardware executing corresponding software, and referring to fig. 3, the apparatus may include:
a receiving module 310 configured to receive an event request from a web page through a data channel established with the web page, where the event request is used to indicate a target event requested by the web page from the operating system;
an obtaining module 320 configured to obtain an event result of the target event;
and the feedback module 330 is configured to feed back the event result of the target event to the webpage through the data channel.
Optionally, the obtaining module 320 includes:
a determination submodule configured to determine an event type of the target event;
and the acquisition sub-module is configured to acquire an event result of the target event according to the event type of the target event.
Optionally, the obtaining sub-module is configured to:
when the event type belongs to the instant event type, the operating system acquires an event result of the target event;
or,
and when the event type belongs to the monitoring event type, the operating system acquires the event result of the target event at preset time intervals.
Optionally, the determining sub-module is configured to:
when the event request comprises the event type of the target event, the operating system acquires the event type of the target event from the event request; or,
when the event request includes a target interface identifier corresponding to the target event, the operating system acquires an event type corresponding to the target interface identifier from a pre-stored corresponding relationship, and determines the acquired event type as the event type of the target event, wherein the corresponding relationship includes a corresponding relationship between at least one group of interface identifiers and the event type, and the interface identifiers are used for identifying interfaces corresponding to the requested event.
Optionally, the feedback module 330 is configured to:
and when the data volume of the event result of the target event is larger than the preset threshold, compressing the event result, and feeding back the compressed event result to the webpage through the data channel.
Optionally, referring to fig. 4, the apparatus further includes:
and the calling module 340 is configured to call a specified service program, and the specified service program is used for acquiring the event result of the target event.
Optionally, the apparatus further comprises:
the establishing module is configured to establish a long connection with a server, and the server is used for establishing a data channel between the operating system and the webpage;
the receiving module 310 is configured to: and receiving the event request forwarded by the server from the webpage through the long connection established between the server and the server.
Optionally, the obtaining module 320 is further configured to:
the method comprises the steps of obtaining an event request from a webpage from a clipboard, wherein the event request is request information which is sent by the webpage to the clipboard and is in a preset format and can be identified by an operating system, and the clipboard is used for establishing a data channel between the operating system and the webpage.
In the embodiment of the disclosure, the operating system receives the event request from the web page through the data channel established between the operating system and the web page, and the operating system acquires the event result according to the event request and then feeds back the acquired event result to the web page, so that the interaction between the web page and the operating system is realized, and the information interaction function of the web page is increased.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of the above functional modules is illustrated, and in practical applications, the above functions may be distributed by different functional modules according to actual needs, that is, the content structure of the device is divided into different functional modules, so as to complete all or part of the functions described above.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 5 is a block diagram illustrating an information interaction device 500, according to an example embodiment. For example, the apparatus 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 5, the apparatus 500 may include one or more of the following components: processing component 502, memory 504, power component 506, multimedia component 508, audio component 510, input/output (I/O) interface 512, sensor component 514, and communication component 516.
The processing component 502 generally controls overall operation of the device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 502 may include one or more processors 520 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 502 can include one or more modules that facilitate interaction between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
The memory 504 is configured to store various types of data to support operations at the apparatus 500. Examples of such data include instructions for any application or method operating on device 500, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 506 provides power to the various components of the device 500. The power components 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power supplies for the apparatus 500.
The multimedia component 508 includes a screen that provides an output interface between the device 500 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 500 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 510 is configured to output and/or input audio signals. For example, audio component 510 includes a Microphone (MIC) configured to receive external audio signals when apparatus 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 504 or transmitted via the communication component 516. In some embodiments, audio component 510 further includes a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the device 500. For example, the sensor assembly 514 may detect an open/closed state of the apparatus 500, the relative positioning of the components, such as a display and keypad of the apparatus 500, the sensor assembly 514 may also detect a change in the position of the apparatus 500 or a component of the apparatus 500, the presence or absence of user contact with the apparatus 500, orientation or acceleration/deceleration of the apparatus 500, and a change in the temperature of the apparatus 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate communication between the apparatus 500 and other devices in a wired or wireless manner. The apparatus 500 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the information interaction methods described in the above embodiments.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 504 comprising instructions, executable by the processor 520 of the apparatus 500 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer-readable storage medium, wherein instructions of the storage medium, when executed by a processor of a mobile terminal, enable the mobile terminal to perform the information interaction method according to the above-described embodiment.
A computer program product containing instructions which, when run on a computer, cause the computer to perform the information interaction method of the above embodiments.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof.

Claims (12)

1. An information interaction method, which is used for an operating system in a mobile terminal, the method comprising:
the operating system establishes long connection with a server, the server is used for establishing a data channel between the operating system and a webpage, and the server is established with a plurality of long connections;
the operating system receives an event request from the webpage forwarded by the server through a long connection established between the operating system and the server, wherein the event request is used for indicating a target event requested by the webpage to the operating system, and the server is used for determining the long connection established with the operating system from the plurality of long connections according to the event request;
after receiving an event request from the webpage, the operating system calls a specified service program, wherein the specified service program is configured in the operating system and is used for acquiring an event result of the target event;
the operating system acquires an event result of a compressed target event sent by an application in the mobile terminal;
and the operating system feeds back the event result of the compressed target event to the webpage through the data channel.
2. The method of claim 1, wherein the operating system obtaining event results for the target event comprises:
the operating system determining an event type of the target event;
and the operating system acquires an event result of the target event according to the event type of the target event.
3. The method of claim 2, wherein the operating system obtaining the event result of the target event according to the event type of the target event comprises:
when the event type belongs to an instant event type, the operating system acquires an event result of the target event;
or,
and when the event type belongs to the monitoring event type, the operating system acquires the event result of the target event once every preset time interval.
4. The method of claim 2, wherein the operating system determining an event type of the target event comprises:
when the event request comprises the event type of the target event, the operating system acquires the event type of the target event from the event request; or,
when the event request comprises a target interface identifier corresponding to the target event, the operating system acquires an event type corresponding to the target interface identifier from a pre-stored corresponding relationship, and determines the acquired event type as the event type of the target event, wherein the corresponding relationship comprises a corresponding relationship between at least one group of interface identifiers and the event type, and the interface identifiers are used for identifying interfaces corresponding to the requested event.
5. The method of any one of claims 1 to 4, wherein the operating system receives an event request from a web page through a data channel established with the web page, comprising:
the operating system acquires the event request from the webpage from a clipboard, wherein the event request is request information which is sent to the clipboard by the webpage and can be identified by the operating system and has a preset format, and the clipboard is used for establishing a data channel between the operating system and the webpage.
6. An information interaction apparatus configured in an operating system in a mobile terminal, the apparatus comprising:
the establishing module is configured to establish a long connection with a server, the server is used for establishing a data channel between the operating system and a webpage, and a plurality of long connections are established in the server;
a receiving module configured to receive an event request from the web page forwarded by the server through a long connection established with the server, where the event request is used to indicate a target event requested by the web page to the operating system, and the server is used to determine a long connection established with the operating system from the plurality of long connections according to the event request;
the calling module is configured to call a specified service program, the specified service program is configured in the operating system, and the specified service program is used for acquiring an event result of the target event;
the acquisition module is configured to acquire an event result of the compressed target event sent by the application in the mobile terminal;
and the feedback module is configured to feed back the event result of the compressed target event to the webpage through the data channel.
7. The apparatus of claim 6, wherein the acquisition module comprises:
a determination submodule configured to determine an event type of the target event;
and the acquisition sub-module is configured to acquire an event result of the target event according to the event type of the target event.
8. The apparatus of claim 7, wherein the acquisition sub-module is configured to:
when the event type belongs to an instant event type, the operating system acquires an event result of the target event;
or,
and when the event type belongs to the monitoring event type, the operating system acquires the event result of the target event once every preset time interval.
9. The apparatus of claim 7, wherein the determination submodule is configured to:
when the event request comprises the event type of the target event, the operating system acquires the event type of the target event from the event request; or,
when the event request comprises a target interface identifier corresponding to the target event, the operating system acquires an event type corresponding to the target interface identifier from a pre-stored corresponding relationship, and determines the acquired event type as the event type of the target event, wherein the corresponding relationship comprises a corresponding relationship between at least one group of interface identifiers and the event type, and the interface identifiers are used for identifying interfaces corresponding to the requested event.
10. The apparatus of any one of claims 6-9, wherein the acquisition module is further configured to:
and acquiring the event request from the webpage from a clipboard, wherein the event request is request information which is sent to the clipboard by the webpage and has a preset format and can be identified by the operating system, and the clipboard is used for establishing a data channel between the operating system and the webpage.
11. An information interaction apparatus, the apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of any of the methods of claims 1-5.
12. A non-transitory computer readable storage medium, having stored thereon a computer program, characterized in that the computer program, when being executed by a processor, realizes the steps of any one of the methods of claims 1-5.
CN201810718210.2A 2018-07-03 2018-07-03 Information interaction method and device and storage medium Active CN108965413B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810718210.2A CN108965413B (en) 2018-07-03 2018-07-03 Information interaction method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810718210.2A CN108965413B (en) 2018-07-03 2018-07-03 Information interaction method and device and storage medium

Publications (2)

Publication Number Publication Date
CN108965413A CN108965413A (en) 2018-12-07
CN108965413B true CN108965413B (en) 2021-08-03

Family

ID=64485140

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810718210.2A Active CN108965413B (en) 2018-07-03 2018-07-03 Information interaction method and device and storage medium

Country Status (1)

Country Link
CN (1) CN108965413B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714425A (en) * 2018-12-29 2019-05-03 北京小米移动软件有限公司 Communication means and device
CN109815030B (en) * 2019-01-10 2021-07-23 北京小米移动软件有限公司 Communication method and device
CN110098999A (en) * 2019-05-09 2019-08-06 携程计算机技术(上海)有限公司 The method and system that IM is managed in the event system of the website OTA
CN111447252B (en) * 2020-02-19 2023-09-26 深圳点猫科技有限公司 Method and system for realizing interactive input based on websocket
CN115509619A (en) * 2022-09-27 2022-12-23 深圳市广和通无线股份有限公司 Operating system event processing method, operating system, electronic device and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102769603A (en) * 2011-05-03 2012-11-07 中国移动通信集团公司 Method, system and apparatus for data transmission
CN102855133A (en) * 2011-07-01 2013-01-02 云联(北京)信息技术有限公司 Interactive system of computer processing unit
US8438287B2 (en) * 2009-11-17 2013-05-07 Motorola Mobility Llc System and method for management of mobile device
CN103634323A (en) * 2013-12-06 2014-03-12 北京奇虎科技有限公司 Long connection based data processing implementation method, system and device
US9077681B2 (en) * 2010-10-05 2015-07-07 Microsoft Technology Licensing, Llc Page loading optimization using page-maintained cache
CN105100074A (en) * 2015-07-01 2015-11-25 小米科技有限责任公司 Data operation processing method, device and terminal equipment
CN105827725A (en) * 2016-04-27 2016-08-03 腾讯科技(深圳)有限公司 Application operating and controlling method and apparatus, and application remote operating and controlling method and apparatus
CN108139952A (en) * 2017-06-14 2018-06-08 北京小米移动软件有限公司 Using exchange method, exchange method and device
CN108156221A (en) * 2017-12-04 2018-06-12 北京小米移动软件有限公司 Communication means, device and electronic equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101946493B (en) * 2008-02-20 2013-06-19 Nabto公司 Method and system for providing connectivity between clients connected to the internet
US20130198266A1 (en) * 2012-01-30 2013-08-01 5O9, Inc. Facilitating communication between web-enabled devices
CN104486327B (en) * 2014-12-10 2019-02-05 北京奇虎科技有限公司 Communication means and client between the page and long connection server
CN104683337A (en) * 2015-02-13 2015-06-03 小米科技有限责任公司 Webpage access method, device and system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8438287B2 (en) * 2009-11-17 2013-05-07 Motorola Mobility Llc System and method for management of mobile device
US9077681B2 (en) * 2010-10-05 2015-07-07 Microsoft Technology Licensing, Llc Page loading optimization using page-maintained cache
CN102769603A (en) * 2011-05-03 2012-11-07 中国移动通信集团公司 Method, system and apparatus for data transmission
CN102855133A (en) * 2011-07-01 2013-01-02 云联(北京)信息技术有限公司 Interactive system of computer processing unit
CN103634323A (en) * 2013-12-06 2014-03-12 北京奇虎科技有限公司 Long connection based data processing implementation method, system and device
CN105100074A (en) * 2015-07-01 2015-11-25 小米科技有限责任公司 Data operation processing method, device and terminal equipment
CN105827725A (en) * 2016-04-27 2016-08-03 腾讯科技(深圳)有限公司 Application operating and controlling method and apparatus, and application remote operating and controlling method and apparatus
CN108139952A (en) * 2017-06-14 2018-06-08 北京小米移动软件有限公司 Using exchange method, exchange method and device
CN108156221A (en) * 2017-12-04 2018-06-12 北京小米移动软件有限公司 Communication means, device and electronic equipment

Also Published As

Publication number Publication date
CN108965413A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN108965413B (en) Information interaction method and device and storage medium
CN108833585B (en) Information interaction method and device and storage medium
CN108831448B (en) Method and device for controlling intelligent equipment through voice and storage medium
RU2637470C2 (en) Method and device for detecting intelligent device
CN108390944B (en) Information interaction method and device
CN108600529B (en) Information interaction method and device and computer readable storage medium
CN104660685A (en) Method and device for obtaining equipment information
CN108702763B (en) Method and device for sending lead code and scheduling request
CN113783774B (en) Cross-cluster network configuration method and device, communication equipment and storage medium
US11375403B2 (en) Method and apparatus for detecting maximum transmission unit value
CN111294881A (en) Network link switching method and device, client and computer readable storage medium
CN105208089A (en) Information display method, apparatus and system
CN104572230B (en) Script file loading method and device and script file generating method and device
CN104618987B (en) Access the method and device of network
CN105376318A (en) File transmission method, device and system
CN106506808B (en) Method and device for prompting communication message
CN109885360B (en) Data processing method, device and storage medium
CN111343731A (en) Information processing method, device and storage medium
CN107070816B (en) Application identification method and device and mobile terminal
CN107911807B (en) Bluetooth data transmission method and device
CN112929271B (en) Route configuration method and device for configuring route
CN113692067B (en) Device connection method and device and readable storage medium
CN114430410A (en) System access method, device and equipment based on virtual domain name
CN112769677A (en) Data synchronization method, data synchronization device, electronic equipment, storage medium and program product
CN109194639B (en) Message receiving and processing method, device, terminal and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant