CN106101124B - Communication channel sharing method and device - Google Patents

Communication channel sharing method and device Download PDF

Info

Publication number
CN106101124B
CN106101124B CN201610510855.8A CN201610510855A CN106101124B CN 106101124 B CN106101124 B CN 106101124B CN 201610510855 A CN201610510855 A CN 201610510855A CN 106101124 B CN106101124 B CN 106101124B
Authority
CN
China
Prior art keywords
webpage
server
domain name
communication channel
target domain
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
CN201610510855.8A
Other languages
Chinese (zh)
Other versions
CN106101124A (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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201610510855.8A priority Critical patent/CN106101124B/en
Publication of CN106101124A publication Critical patent/CN106101124A/en
Application granted granted Critical
Publication of CN106101124B publication Critical patent/CN106101124B/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
    • 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

Abstract

The embodiment of the invention discloses a communication channel sharing method and a device, which are applied to the technical field of Internet, wherein the method comprises the following steps: when a target browser is used for opening a webpage under a target domain name, judging whether a communication channel of a server corresponding to the target domain name exists at present; if the communication channel does not exist, a communication channel with the server is established; when data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel; and if the data communication exists, when the data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel. By applying the communication channel sharing method and device provided by the embodiment of the invention, the communication efficiency can be improved, and the bandwidth and IO pressure of the server can be reduced.

Description

Communication channel sharing method and device
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method and an apparatus for sharing a communication channel.
Background
WebSocket is a technology generated for solving the problem of real-time communication between a client and a server. The essence of the method is that a TCP connection for exchanging data is established after handshaking is carried out through an HTTP/HTTPS protocol, and then the server and the client communicate in real time through the TCP connection. WebSocket provides a continuous link and a duplex communication mechanism with a server, and is used for solving the problems of Http/https requests, a feedback mode and strict one-way communication from a client to the server.
At present, each time a web page is opened by using a browser, a corresponding WebSocket link is created for the web page, and the WebSocket link is also called as a communication channel under a common condition.
However, each time a WebSocket link client is created, a handshake with the server is required, and the WebSocket link can be created only after the handshake is successfully completed. The client and the server have low communication efficiency due to the time taken for the client to handshake with the server. And the server needs to maintain a plurality of WebSocket links, which aggravates the bandwidth and IO pressure of the server.
Disclosure of Invention
The embodiment of the invention aims to provide a communication channel sharing method and a communication channel sharing device, which are used for improving communication efficiency and reducing bandwidth and IO (input/output) pressure of a server.
In order to achieve the above object, an embodiment of the present invention discloses a communication channel sharing method, where the method includes:
when a target browser is used for opening a webpage under a target domain name, judging whether a communication channel of a server corresponding to the target domain name exists at present;
if the communication channel does not exist, a communication channel with the server is established; when data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel;
and if the data communication exists, when the data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel.
Preferably, before the communication channel with the server is created, the method further includes:
marking the webpage as a homepage label corresponding to the target domain name;
when the data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel, and the method comprises the following steps:
sending a data request based on the webpage to a local storage of the target browser;
calling a callback function corresponding to the main tab and used for fetching data from the local storage, and sending the data request stored in the local storage to the server through the communication channel;
receiving target data fed back by the server through the communication channel;
storing the target data in the local store;
and calling a callback function corresponding to the webpage, and feeding back the target data stored in the local storage to a user based on the webpage.
Preferably, the method further comprises:
when the webpage under the target domain name is closed, judging whether the closed webpage is a webpage marked as a main tab or not;
if yes, one of the current web pages under the target domain name is marked as a main tab.
Preferably, the marking one of the web pages under the current target domain name as a main tab includes:
randomly selecting from the web pages under the current target domain name;
and marking the selected webpage as a main tab.
Preferably, the marking one of the web pages under the current target domain name as a main tab includes:
and marking the webpage which is opened by the user for the last time in the webpage under the current target domain name as a main tab.
Preferably, the marking one of the web pages under the current target domain name as a main tab includes:
judging whether a webpage identical to the closed webpage exists in the current webpage under the target domain name;
if so, the same web page as the closed web page is marked as the home tab.
Preferably, the marking one of the web pages under the current target domain name as a main tab includes:
judging whether a homepage of the target domain name exists in the current webpage under the target domain name;
if so, the home page is marked as a home tab.
In order to achieve the above object, an embodiment of the present invention further discloses a communication channel sharing device, where the device includes:
the first judgment module is used for judging whether a communication channel of a server corresponding to a target domain name exists at present when a webpage under the target domain name is opened by using a target browser;
the establishing module is used for establishing a communication channel with the server under the condition that the judgment result of the first judging module is negative;
and the communication module is used for carrying out data communication with the server by utilizing the communication channel when carrying out data communication with the server through the webpage.
Preferably, the device further includes a first marking module, where the first marking module is configured to mark the web page as a home page label corresponding to the target domain name before a communication channel with the server is created;
the communication module is specifically used for: sending a data request based on the webpage to a local storage of the target browser; calling a callback function corresponding to the main tab and used for fetching data from the local storage, and sending the data request stored in the local storage to the server through the communication channel; receiving target data fed back by the server through the communication channel; storing the target data in the local store; and calling a callback function corresponding to the webpage, and feeding back the target data stored in the local storage to a user based on the webpage.
Preferably, the device further comprises a second judging module and a second marking module,
the second judging module is used for judging whether the closed webpage is the webpage marked as the main tab or not when the webpage under the target domain name is closed;
the second marking module is configured to mark one of the current webpages under the target domain name as a main tab if the determination result of the second determining module is yes.
Preferably, the second marking module is specifically configured to:
and under the condition that the judgment result of the second judgment module is yes, randomly selecting from the webpages under the current target domain name, and marking the selected webpages as main tabs.
Preferably, the second marking module is specifically configured to:
and under the condition that the judgment result of the second judgment module is yes, marking the webpage which is opened by the user for the last time in the current webpage under the target domain name as a main tab.
Preferably, the second marking module is specifically configured to:
under the condition that the judgment result of the second judgment module is yes, judging whether a webpage identical to the closed webpage exists in the webpage under the current target domain name or not; if so, the same web page as the closed web page is marked as the home tab.
Preferably, the second marking module is specifically configured to:
under the condition that the judgment result of the second judgment module is yes, judging whether a homepage of the target domain name exists in the webpage under the current target domain name;
if so, the home page is marked as a home tab.
As can be seen from the foregoing technical solutions, in the communication channel sharing method and apparatus provided in the embodiments of the present invention, when a target browser is used to open a web page under a target domain name, it is determined whether a communication channel of a server corresponding to the target domain name exists currently; if the communication channel does not exist, a communication channel with the server is established; when data communication is carried out with the server through the webpage, the communication channel is utilized to carry out data communication with the server; and if the data communication exists, when the data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel. Therefore, the embodiment of the invention can realize that a plurality of webpages under the target domain name share the same communication channel, avoid that each webpage and the server need to carry out websocket handshake once, and improve the communication efficiency; only one communication channel needs to be maintained at the server end, and the bandwidth and IO pressure of the server are reduced.
Of course, it is not necessary for any method or device embodying the present invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a communication channel sharing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another communication channel sharing method according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a communication channel sharing method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a communication channel sharing device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a communication channel sharing device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a communication channel sharing device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
To solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for sharing a communication channel, which are described in detail below.
It should be noted that the local storage is one of the characteristic APIs of the web storage, and is mainly used for storing data in the client. The local store is intra-domain secure, i.e., the local store is domain-based, and any web page within the domain has access to the local store data. There is a problem in that data between browsers of respective browser vendors is independent.
In the existing WebSocket duplex communication, a processing function is loaded after a webpage is opened, the processing function has the capability of communicating with a server, a client only needs to send a request to establish a communication channel with the server, and the client can send a message to the server at any time after the channel is successfully established.
Based on the above, the embodiment of the present invention provides a solution for solving the problem that a plurality of webpages share one communication channel, when a webpage is opened, a processing function is loaded, and a callback function is registered, so that the plurality of webpages can realize instant messaging with a server only by establishing one communication channel. According to the scheme, based on the cross-tag sharing capability of the same domain name of local storage, the workflow allowing registration events to monitor and receive events is utilized, and therefore the multiple webpages can share one websocket communication channel.
Fig. 1 is a schematic flow chart of a communication channel sharing method according to an embodiment of the present invention, including the following steps:
s101, when a webpage under a target domain name is opened by using a target browser, judging whether a communication channel of a server corresponding to the target domain name exists or not, if not, executing S102, and if so, executing S103.
As will be understood by those skilled in the art, when the web page is opened for the first time under the target domain name, a handshake with the server is required to establish a communication channel, otherwise, communication with the server cannot be completed.
In the existing scheme, when each webpage is opened, a browser needs to handshake with a server to establish a communication channel, and then transmits the data in a subsequent data request by using the established communication channel.
And S102, establishing a communication channel with the server.
It will be appreciated by those skilled in the art that when a web page is opened for the first time for a target domain name, there is no communication channel, and the web page needs to handshake with the server successfully to send a request. Therefore, when the webpage is opened for the first time, a communication channel must be created, otherwise, communication with the server cannot be completed.
For example, if the web page is the 2 nd opened web page under the target domain name, and before this, a communication channel is already established for communicating with the server when the web page is opened for the first time, the 2 nd opened web page does not need to handshake with the server. The procedure is still followed when the web page is opened 3 rd and 4 th times. It should be noted that the number of times of opening used in the embodiments of the present invention is merely exemplary, and is not intended to limit the present invention.
And S103, when the data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel.
Illustratively, when the webpage is the 2 nd opened webpage under the target domain name and needs to communicate with the server, a data request is sent, the data request and the mark information of the second opened webpage are transmitted to the webpage corresponding to the communication channel, and the request is sent to the server through the communication channel established by the webpage. In the prior art, the ID of the web page is usually understood to correspond to the web page, and the flag information is only required to enable the target data transmitted back by the server to correspond to the web page of the sending request, and is not particularly limited in the present invention.
In practical application, the request message for opening the webpage for the 2 nd time is sent to a local storage corresponding to the target browser, the local storage triggers a callback function registered in the webpage corresponding to the communication channel after receiving the request message, and the callback function reads the request message to the corresponding webpage and then sends the request message to the corresponding server. And after receiving and processing the request message, the server feeds back target data, transmits the target data to a webpage corresponding to the target data through a communication channel, and sends the target data to local storage or performs corresponding processing by the server. And after the local storage receives the data, triggering a corresponding registration callback function, and calling back the data to a corresponding webpage for processing. Here, the callback function is the prior art, and the present invention is not described herein.
As will be understood by those skilled in the art, when a web page is opened, a corresponding processing function is loaded, and a corresponding callback function is registered with the processing function as a frame, so that the callback function forms a corresponding relationship with the web page, and the function can identify flag information corresponding to the web page, so as to call back target data processed by the web page from a local storage correspondingly.
Therefore, by applying the embodiment of fig. 1 of the present invention, a plurality of webpages under a target domain name can share the same communication channel, so that a websocket handshake between each webpage and a server is avoided, and the communication efficiency is improved; only one communication channel needs to be maintained at the server end, and the bandwidth and IO pressure of the server are reduced.
Fig. 2 is another schematic flow chart of a communication channel sharing method according to an embodiment of the present invention, where the embodiment shown in fig. 2 is based on the embodiment shown in fig. 1, and S104 is added before S102.
S104, marking the webpage as a homepage label corresponding to the target domain name.
As will be appreciated by those skilled in the art, the first time a web page is opened under the target domain name, the web page needs to establish a communication channel with the server for data transmission request and target data reception. Before the communication channel is established, the first opened webpage under the target domain name is marked as a main tab for establishing a corresponding relation with the channel, so that the later established webpage sends request data to the target webpage, namely the main tab.
Specifically, in practical applications, a processing function is loaded when a web page is opened, and a callback function corresponding to a homepage sign is registered. The main tab writes its own identification information (including a specific identification with the domain name and itself), open time, and role information (main tab or non-main tab) into the local storage. The main tabs correspond to the domain names, when a plurality of domain names need to be opened for websocket communication, a plurality of corresponding main tabs need to be created, and the main tabs respectively correspond to the corresponding communication channels.
Specifically, when data communication is performed with the server through the web page, data communication is performed with the server through the communication channel, and a data request based on the web page can be sent to the local storage of the target browser; calling a callback function corresponding to the main tab and used for fetching data from the local storage, and sending the data request stored in the local storage to the server through the communication channel; receiving target data fed back by the server through the communication channel; storing the target data in the local store; and calling a callback function corresponding to the webpage, and feeding back the target data stored in the local storage to a user based on the webpage.
As can be understood by those skilled in the art, when a web page under a target domain name is opened, a processing function is loaded, and a callback function is correspondingly registered, so that a tab and the callback function form a corresponding relationship. When a webpage needs to send a request message, sending a data request to a corresponding storage interface of the browser, namely corresponding local storage; after the local storage receives the data request, a storage information change signal is sent, and a callback function corresponding to the main page label is triggered to read the data request into the main page label; the request is sent to the server on a communication channel established by the homepage sign and the server.
The server receives and processes the data request, sends target data to the browser, sends the target data to the local storage after the homepage sign is received, sends a storage information change signal after the local storage is received, triggers a corresponding callback function, and calls back the target function to the corresponding webpage for processing.
In practical application, the following can be adopted: after the homepage label receives the target data sent by the server, judging whether the data request is a data request sent based on the homepage label, if so, processing by the homepage label, and if not, executing the corresponding processing sent to the local storage.
In practical application, a communication channel is established between the service hub and the homepage tag and is used for sending and receiving the websocket messages. When the service concentrator receives the message sent by the terminal, the message is respectively distributed to a specific server for processing according to the message type in the message body.
Therefore, by applying the embodiment of fig. 2 of the present invention, it is possible to respectively create corresponding communication channels by using the main page label as a mark under a plurality of target domain names, so as to respectively establish communication channels for a plurality of domain names.
Fig. 3 is a schematic flow chart of a communication channel sharing method according to an embodiment of the present invention, where the embodiment shown in fig. 3 is added with S105 and S106 on the basis of the embodiment shown in fig. 2.
S105, when the webpage under the target domain name is closed, judging whether the closed webpage is the webpage marked as the main tab, if so, executing S106.
It can be understood by those skilled in the art that, when a certain web page needs to be closed, a plurality of web pages opened under the target domain name first determine whether the web page is a web page that has been marked as a main tab. As described above, the main tab corresponds to the communication channel, and if the main tab is closed, one end of the connection channel is closed, and data cannot be transmitted or received.
S106, one of the current web pages under the target domain name is marked as a main tab.
Specifically, one of the current webpages under the target domain name is marked as a main tab, and the webpage under the target domain name can be randomly selected; and marking the selected webpage as a main tab. And the webpage which is opened by the user for the last time in the webpage under the current target domain name can be marked as the main tab. Whether a webpage identical to the closed webpage exists in the current webpage under the target domain name can also be judged; if so, the same web page as the closed web page is marked as the home tab. Whether a homepage of the target domain name exists in the current webpage under the target domain name can also be judged; if so, the home page is marked as a home tab.
It will be understood by those skilled in the art that if the web page that is closed is a non-home tab corresponding web page, no processing is done. If the webpage is the webpage corresponding to the home tab, the opened webpage needs to be reselected to be reset as the home tab, so that the existence of both communication parties is maintained.
As can be understood by those skilled in the art, when all the web pages are closed, the communication channel is closed, the binding relationship between the callback function and the corresponding tab is released, and when the web pages are opened again, the corresponding relationship is reset. The callback function is the prior art, and details are not described herein.
Therefore, by applying the embodiment of fig. 3 of the present invention, the homepage label under the corresponding target domain name can be reset, so that the communication channel can be maintained as long as one webpage is opened under the same domain name, so as to maintain the continuity of the communication channel sharing.
Fig. 4 is a schematic structural diagram of a communication channel sharing device according to an embodiment of the present invention, which may include a first determining module 201, a creating module 202, and a communication module 203.
A first determining module 201, configured to determine whether a communication channel of a server corresponding to a target domain name exists currently when a target browser is used to open a web page under the target domain name;
a creating module 202, configured to create a communication channel with the server if the determination result of the first determining module 201 is negative;
and the communication module 203 is configured to perform data communication with the server by using the communication channel when performing data communication with the server through the web page.
Therefore, by applying the embodiment of fig. 4 of the present invention, a plurality of webpages under a target domain name can share the same communication channel, so that a websocket handshake between each webpage and a server is avoided, and the communication efficiency is improved; only one duplex channel needs to be maintained at the server end, and the bandwidth and IO pressure of the server are reduced.
Fig. 5 is another schematic structural diagram of a communication channel sharing device according to an embodiment of the present invention, and the embodiment shown in fig. 5 of the present invention is added with a first mark module 204 on the basis of the embodiment shown in fig. 4.
The first marking module 204 is configured to mark the web page as a home page label corresponding to the target domain name.
The communication module 203 is specifically configured to: sending a data request based on the webpage to a local storage of the target browser; calling a callback function corresponding to the main tab and used for fetching data from the local storage, and sending the data request stored in the local storage to the server through the communication channel; receiving target data fed back by the server through the communication channel; storing the target data in the local store; and calling a callback function corresponding to the webpage, and feeding back the target data stored in the local storage to a user based on the webpage.
Therefore, by applying the embodiment of fig. 5 of the present invention, it is possible to respectively create corresponding communication channels by using the main page label as a mark under a plurality of target domain names, so as to respectively establish communication channels for a plurality of domain names.
Fig. 6 is another schematic structural diagram of a communication channel sharing device according to an embodiment of the present invention, and a second determining module 205 and a second marking module 206 are added to the embodiment shown in fig. 5 according to the embodiment shown in fig. 6 of the present invention.
The second determining module 205 is configured to determine, when the web page under the target domain name is closed, whether the closed web page is a web page marked as a main tab;
the second marking module 206 is configured to mark one of the current webpages under the target domain name as a main tab if the determination result of the second determining module is yes.
The second marking module 206 shown in the embodiment of the present invention may be specifically configured to:
if the result of the second determination module 205 is yes, randomly selecting from the web pages under the current target domain name, and marking the selected web pages as main tabs.
The second marking module 206 shown in the embodiment of the present invention may be specifically configured to:
if the result of the second determination module 205 is yes, the web page that is opened by the user in the current web page under the target domain name for the last time is marked as the main tab.
The second marking module 206 shown in the embodiment of the present invention may be specifically configured to:
if the determination result of the second determining module 205 is yes, determining whether a webpage identical to the closed webpage exists in the current webpage under the target domain name; if so, the same web page as the closed web page is marked as the home tab.
The second marking module 206 shown in the embodiment of the present invention may be specifically configured to:
if the determination result of the second determining module 205 is yes, determining whether a home page of the target domain name exists in the current web page of the target domain name; if so, the home page is marked as a home tab.
Therefore, by applying the embodiment of fig. 6 of the present invention, the homepage label under the corresponding target domain name can be reset, so that the communication channel can be maintained as long as one webpage is opened under the same domain name, so as to maintain the continuity of communication.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Those skilled in the art will appreciate that all or part of the steps in the above method embodiments may be implemented by a program to instruct relevant hardware to perform the steps, and the program may be stored in a computer-readable storage medium, which is referred to herein as a storage medium, such as: ROM/RAM, magnetic disk, optical disk, etc.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for sharing a communication channel, the method comprising:
when a target browser is used for opening a webpage under a target domain name, judging whether a communication channel of a server corresponding to the target domain name exists at present;
if the communication channel does not exist, a communication channel with the server is established; when data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel;
if the data communication exists, when the data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel;
before creating a communication channel with the server, the method further comprises:
marking the webpage as a homepage label corresponding to the target domain name;
when the data communication is carried out with the server through the webpage, the data communication is carried out with the server by utilizing the communication channel, and the method comprises the following steps:
sending a data request based on the webpage to a local storage of the target browser;
calling a callback function corresponding to the main tab and used for fetching data from the local storage, and sending the data request stored in the local storage to the server through the communication channel;
receiving target data fed back by the server through the communication channel;
storing the target data in the local store;
calling a callback function corresponding to the webpage, and feeding back the target data stored in the local storage to a user based on the webpage;
the method further comprises the following steps:
when the webpage under the target domain name is closed, judging whether the closed webpage is a webpage marked as a main tab or not;
if yes, one of the current web pages under the target domain name is marked as a main tab.
2. The method of claim 1, wherein the marking one of the web pages currently under the target domain name as a main tab comprises:
randomly selecting from the web pages under the current target domain name;
and marking the selected webpage as a main tab.
3. The method of claim 1, wherein the marking one of the web pages currently under the target domain name as a main tab comprises:
and marking the webpage which is opened by the user for the last time in the webpage under the current target domain name as a main tab.
4. The method of claim 1, wherein the marking one of the web pages currently under the target domain name as a main tab comprises:
judging whether a webpage identical to the closed webpage exists in the current webpage under the target domain name;
if so, the same web page as the closed web page is marked as the home tab.
5. The method of claim 1, wherein the marking one of the web pages currently under the target domain name as a main tab comprises:
judging whether a homepage of the target domain name exists in the current webpage under the target domain name;
if so, the home page is marked as a home tab.
6. A communication channel sharing apparatus, comprising:
the first judgment module is used for judging whether a communication channel of a server corresponding to a target domain name exists at present when a webpage under the target domain name is opened by using a target browser;
the establishing module is used for establishing a communication channel with the server under the condition that the judgment result of the first judging module is negative;
the communication module is used for carrying out data communication with the server by utilizing the communication channel when carrying out data communication with the server through the webpage;
the device further comprises: a first marking module for marking the first mark of the image,
the first marking module is used for marking the webpage as a homepage label corresponding to the target domain name before a communication channel with the server is established;
the communication module is specifically used for:
sending a data request based on the webpage to a local storage of the target browser;
calling a callback function corresponding to the main tab and used for fetching data from the local storage, and sending the data request stored in the local storage to the server through the communication channel;
receiving target data fed back by the server through the communication channel;
storing the target data in the local store;
calling a callback function corresponding to the webpage, and feeding back the target data stored in the local storage to a user based on the webpage;
the device further comprises: a second judging module and a second marking module,
the second judging module is used for judging whether the closed webpage is the webpage marked as the main tab or not when the webpage under the target domain name is closed;
the second marking module is configured to mark one of the current webpages under the target domain name as a main tab if the determination result of the second determining module is yes.
7. The apparatus of claim 6, wherein the second labeling module is specifically configured to:
and under the condition that the judgment result of the second judgment module is yes, randomly selecting from the webpages under the current target domain name, and marking the selected webpages as main tabs.
8. The apparatus of claim 6, wherein the second labeling module is specifically configured to:
and under the condition that the judgment result of the second judgment module is yes, marking the webpage which is opened by the user for the last time in the current webpage under the target domain name as a main tab.
9. The apparatus of claim 6, wherein the second labeling module is specifically configured to:
under the condition that the judgment result of the second judgment module is yes, judging whether a webpage identical to the closed webpage exists in the webpage under the current target domain name or not; if so, the same web page as the closed web page is marked as the home tab.
10. The apparatus of claim 6, wherein the second labeling module is specifically configured to:
under the condition that the judgment result of the second judgment module is yes, judging whether a homepage of the target domain name exists in the webpage under the current target domain name;
if so, the home page is marked as a home tab.
CN201610510855.8A 2016-06-30 2016-06-30 Communication channel sharing method and device Active CN106101124B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610510855.8A CN106101124B (en) 2016-06-30 2016-06-30 Communication channel sharing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610510855.8A CN106101124B (en) 2016-06-30 2016-06-30 Communication channel sharing method and device

Publications (2)

Publication Number Publication Date
CN106101124A CN106101124A (en) 2016-11-09
CN106101124B true CN106101124B (en) 2020-05-08

Family

ID=57211881

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610510855.8A Active CN106101124B (en) 2016-06-30 2016-06-30 Communication channel sharing method and device

Country Status (1)

Country Link
CN (1) CN106101124B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110300137B (en) * 2018-03-22 2021-10-08 腾讯科技(深圳)有限公司 Communication method, communication apparatus, computer device, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420805A (en) * 2010-09-27 2012-04-18 阿里巴巴集团控股有限公司 Method, system and device for communication by virtue of socket connection
CN102739619A (en) * 2011-04-14 2012-10-17 阿里巴巴集团控股有限公司 Data communication method and apparatus
CN105119986A (en) * 2015-08-12 2015-12-02 国家电网公司 Web reverse proxy method based on preconnect
CN105592424A (en) * 2014-10-24 2016-05-18 东莞宇龙通信科技有限公司 Network sharing method, network sharing device, and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9537946B2 (en) * 2012-04-29 2017-01-03 Joseph Atias System and method for creating and sharing user-generated information
CN103702238B (en) * 2013-12-23 2017-11-28 华为终端有限公司 A kind of multi-screen video sharing method and terminal, server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420805A (en) * 2010-09-27 2012-04-18 阿里巴巴集团控股有限公司 Method, system and device for communication by virtue of socket connection
CN102739619A (en) * 2011-04-14 2012-10-17 阿里巴巴集团控股有限公司 Data communication method and apparatus
CN105592424A (en) * 2014-10-24 2016-05-18 东莞宇龙通信科技有限公司 Network sharing method, network sharing device, and terminal
CN105119986A (en) * 2015-08-12 2015-12-02 国家电网公司 Web reverse proxy method based on preconnect

Also Published As

Publication number Publication date
CN106101124A (en) 2016-11-09

Similar Documents

Publication Publication Date Title
CN110300050B (en) Message pushing method and device, computer equipment and storage medium
MX2021010448A (en) Method for processing live-streaming interaction video and server.
EP3222069B1 (en) Method and device for sharing enriched information associated with a call
EP3002927B1 (en) Page redirection method, routing device, terminal device and system
CN104378399B (en) A kind of data push method, Platform Server, client and system
US7870412B2 (en) Passing client or server instructions via synchronized data objects
US9176793B2 (en) Managed channel for asynchronous requests
US11558322B2 (en) Communication management system
US9762734B1 (en) Intermediary device for data message network routing
DE602004006308D1 (en) METHOD FOR CLAIMING CLIENT REQUIREMENTS FOR WEB SERVICES
US11689383B2 (en) System, method, and computer-readable medium for streaming real-time data from a user device
CN101977209A (en) Method for realizing page-turning synchronization on web page
CN112751897B (en) Load balancing method, device, medium and equipment
CN108881395B (en) Message pushing method, device, message manager and computer readable storage medium
CN110113298B (en) Data transmission method, device, signaling server and computer readable medium
CN104320463A (en) Queuing information acquiring method and device for mobile terminal and queuing information providing method and device
CN106101124B (en) Communication channel sharing method and device
US20190370293A1 (en) Method and apparatus for processing information
US20140289335A1 (en) Method and apparatus of configuring a data broadcast service
WO2017036235A1 (en) Information transmission method and device
WO2019119974A1 (en) Object uploading method and device
US20140032744A1 (en) Method of comparing outputs in a plurality of information systems
CN108924773B (en) Message processing method and device
FI111587B (en) Communication method and system
CN113691684A (en) Outbound method, device, system, computer equipment and storage medium

Legal Events

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