CN112486587A - Web browser plug-in based on WebSocket and data interaction method - Google Patents
Web browser plug-in based on WebSocket and data interaction method Download PDFInfo
- Publication number
- CN112486587A CN112486587A CN202011314874.6A CN202011314874A CN112486587A CN 112486587 A CN112486587 A CN 112486587A CN 202011314874 A CN202011314874 A CN 202011314874A CN 112486587 A CN112486587 A CN 112486587A
- Authority
- CN
- China
- Prior art keywords
- service
- websocket
- browser plug
- web browser
- plug
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 16
- 230000003993 interaction Effects 0.000 title claims abstract description 13
- 230000004044 response Effects 0.000 claims description 23
- 230000010354 integration Effects 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 abstract description 10
- 230000008569 process Effects 0.000 abstract description 6
- 230000008878 coupling Effects 0.000 abstract description 3
- 238000010168 coupling process Methods 0.000 abstract description 3
- 238000005859 coupling reaction Methods 0.000 abstract description 3
- 230000015556 catabolic process Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a Web browser plug-in based on WebSocket and a data interaction method. The Web browser plug-in comprises a browser plug-in front end installed on a Web browser and a browser plug-in rear end installed on a computer terminal, the Web browser plug-in adopts a structure with a front end and a rear end separated, the browser plug-in rear end and the browser plug-in front end operate in different processes, the stability of the browser and plug-in service can be improved, the browser plug-in rear end adopts a service framework for layered treatment, and the functions of bottom function libraries integrated by coupling are different, so that the Web browser plug-in can be suitable for various application scenes; the data interaction between the front end and the back end of the Web browser plug-in is realized based on a WebSocket technology, is independent of a specific browser plug-in frame, and has good browser compatibility.
Description
Technical Field
The invention relates to a Web browser plug-in, in particular to a Web browser plug-in based on WebSocket and a data interaction method.
Background
In many cases, data interaction between a Web page in a Web browser and some background processes/local devices is required, for example, the Web page needs to use a U-shield, a specific website needs to be logged in and identity authentication needs to be performed by using a usb key, and the like, the data interaction is realized through a browser plug-in, and the traditional method is realized based on an ActiveX, npapi or ppapi frame/technology, however, the traditional plug-in frame/technology has the problems of poor stability, browser incompatibility, technology lag and the like.
At present, a newer browser plug-in technical scheme is developed based on an extension plus native messaging technology, but the problems that the release is limited by a Google application store, the implementation of each browser is different, the universality is poor and the like exist.
Meanwhile, the current browser plug-in runs in the browser process space, and when the plug-in is abnormal, web page breakdown and plug-in service breakdown can be caused. WebSocket is a popular Web communication technology at present and has good browser compatibility, and on the basis, a browser plug-in technical scheme with good browser compatibility, safety and stability is urgently needed.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a Web browser plug-in based on WebSocket and a data interaction method, and the Web browser plug-in has good browser compatibility and plug-in service stability.
The technical scheme of the Web browser plug-in provided by the invention is as follows:
a Web browser plug-in based on WebSocket comprises a browser plug-in front end installed on a Web browser and a browser plug-in rear end installed on a computer terminal, wherein the browser plug-in front end comprises a WebSocket client used for forwarding service requests and responses; the browser plug-in back end comprises:
the WebSocket server is used for analyzing the service request, requesting the service middleware interface service and returning the service response;
the service middleware is used for responding to the internal service request and calling the bottom function library to complete service response;
the bottom function library is used for realizing specific service functions;
and the service monitoring program is used for monitoring and restarting the WebSocket server which exits unexpectedly.
Furthermore, the WebSocket client provides module integration in a JS script mode and integrates the module integration to a Web browser webpage in a code module embedding mode.
Furthermore, the number of the bottom-layer function libraries is at least two, the bottom-layer function libraries are loosely coupled to the service middleware in a mode of adding corresponding configuration items in the browser plug-in back-end configuration file, and the bottom-layer function libraries are loaded when the browser plug-in back end is started.
The invention also provides a data interaction method of the Web browser plug-in based on the WebSocket, which comprises the following steps:
1) the WebSocket client is integrated to a Web browser webpage;
2) installing the rear end of a browser plug-in at a computer terminal;
3) the service monitoring program is started automatically, whether the WebSocket server program is online or not is judged, and if the WebSocket server program is not online, the WebSocket server program is started;
4) a webpage of the Web browser calls a WebSocket client interface to initiate a service request;
5) the WebSocket client forwards the service request to the WebSocket server;
6) the WebSocket server analyzes the specific service request and calls a corresponding service middleware interface;
7) the service middleware calls a corresponding bottom layer function library interface to complete service response, and the service response is returned to the service middleware;
8) the service middleware forwards the service response to the WebSocket server;
9) the WebSocket server forwards the service response to the WebSocket client;
10) the WebSocket client interface returns a service response to the Web page.
Compared with the prior art, the invention has the advantages that:
1. the method is based on the widely popular WebSocket technology, has no hidden trouble of technology obsolescence and elimination for a long time, does not depend on a specific browser plug-in framework, and has no defect of poor compatibility of the traditional browser plug-in framework/technology;
2. the front end and the back end of the Web browser plug-in are separated, the front end and the back end process of the browser plug-in are isolated during the operation, the stability of the browser and the plug-in service is improved, the browser operation is not influenced when the back end of the browser plug-in is broken down, and the browser operation is not influenced when the browser is broken down;
3. the back end of the Web browser plug-in adopts a service framework of layered management, and is suitable for various application scenes according to different functions of a bottom function library integrated by coupling.
Drawings
Fig. 1 is a schematic structural diagram of a Web browser plug-in according to an embodiment of the present invention.
Detailed Description
The invention is further described below with reference to the drawings and specific preferred embodiments of the description, without thereby limiting the scope of protection of the invention.
As shown in fig. 1, the present invention provides a Web browser plug-in based on WebSocket, which implements data interaction between a browser and a background process/local device, and is composed of a WebSocket client, a WebSocket server, a service monitor, a service middleware, and a bottom-layer function library. The WebSocket client side is integrated to a Web browser webpage in a JS script mode, is used for forwarding service requests and responses by the front end of a browser plug-in and is operated on the background by the WebSocket server side, a service monitoring program, middleware and a bottom function library to form the rear end of the browser plug-in and is used for analyzing, forwarding and responding to the service requests.
The data interaction method for the Web browser plug-in based on the WebSocket provided by the embodiment comprises the following steps:
1) the WebSocket client is integrated to a Web browser webpage;
2) installing the rear end of a browser plug-in at a computer terminal;
3) the service monitoring program is started automatically, whether the WebSocket server program is online or not is judged, and if the WebSocket server program is not online, the WebSocket server program is started;
4) a webpage of the Web browser calls a WebSocket client interface to initiate a service request;
5) the WebSocket client forwards the service request to the WebSocket server;
6) the WebSocket server analyzes the specific service request and calls a corresponding service middleware interface;
7) the service middleware calls a corresponding bottom layer function library interface to complete service response, and the service response is returned to the service middleware;
8) the service middleware forwards the service response to the WebSocket server;
9) the WebSocket server forwards the service response to the WebSocket client;
10) the WebSocket client interface returns a service response to the Web page.
The Web browser plug-in provided by the embodiment is realized based on the currently popular WebSocket technology, does not depend on a specific browser plug-in frame, and has good browser compatibility.
The Web browser plug-in provided by this embodiment adopts a structure in which the front end and the back end are separated, the back end of the browser plug-in and the front end of the browser plug-in operate in different processes, data interaction is realized based on WebSocket, the browser operation is not affected by the crash of the back end of the browser plug-in, and similarly, the browser crash does not affect the operation of the back end of the browser plug-in, so that the stability of the browser and the plug-in service can be improved.
The browser plug-in back end of the Web browser plug-in provided by the embodiment adopts a layered management service framework, and is applicable to various application scenarios according to different functions of a bottom function library integrated by coupling: the WebSocket server is only responsible for service request analysis, middleware interface service requests and service response return, the service middleware is responsible for responding to internal service requests, calling underlying function libraries to complete service response, the underlying function libraries are loosely coupled to the service middleware in a mode of adding corresponding configuration items in a browser plug-in back-end configuration file, loading is carried out when the browser plug-in back end is started, specific service functions are achieved, and the service monitoring program is responsible for monitoring the state of the WebSocket server, restarting the server program which is accidentally exited, and ensuring the stability of the browser plug-in back-end service.
The foregoing is considered as illustrative of the preferred embodiments of the invention and is not to be construed as limiting the invention in any way. Although the present invention has been described with reference to the preferred embodiments, it is not intended to be limited thereto. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical spirit of the present invention should fall within the protection scope of the technical scheme of the present invention, unless the technical spirit of the present invention departs from the content of the technical scheme of the present invention.
Claims (4)
1. A Web browser plug-in based on WebSocket is characterized by comprising a browser plug-in front end installed on a Web browser and a browser plug-in rear end installed on a computer terminal, wherein the browser plug-in front end comprises a WebSocket client used for forwarding a service request and responding; the browser plug-in back end comprises:
the WebSocket server is used for analyzing the service request, requesting the service middleware interface service and returning the service response;
the service middleware is used for responding to the internal service request and calling the bottom function library to complete service response;
the bottom function library is used for realizing specific service functions;
and the service monitoring program is used for restarting the WebSocket server which is accidentally exited.
2. The WebSocket-based Web browser plug-in of claim 1, wherein the WebSocket client provides module integration in the form of a JS script and integrates to a Web browser webpage in the form of code module embedding.
3. The Web socket-based Web browser plug-in of claim 1, wherein the number of the underlying function libraries is at least two, and the underlying function libraries are loosely coupled to the service middleware in a manner of adding corresponding configuration items in a browser plug-in backend configuration file and are loaded when the browser plug-in backend is started.
4. The data interaction method of the Web browser plug-in based on the WebSocket is characterized by comprising the following steps of:
1) the WebSocket client is integrated to a Web browser webpage;
2) installing the rear end of a browser plug-in at a computer terminal;
3) the service monitoring program is started automatically, whether the WebSocket server program is online or not is judged, and if the WebSocket server program is not online, the WebSocket server program is started;
4) a webpage of the Web browser calls a WebSocket client interface to initiate a service request;
5) the WebSocket client forwards the service request to the WebSocket server;
6) the WebSocket server analyzes the specific service request and calls a corresponding service middleware interface;
7) the service middleware calls a corresponding bottom layer function library interface to complete service response, and the service response is returned to the service middleware;
8) the service middleware forwards the service response to the WebSocket server;
9) the WebSocket server forwards the service response to the WebSocket client;
10) the WebSocket client interface returns a service response to the Web page.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011314874.6A CN112486587A (en) | 2020-11-20 | 2020-11-20 | Web browser plug-in based on WebSocket and data interaction method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011314874.6A CN112486587A (en) | 2020-11-20 | 2020-11-20 | Web browser plug-in based on WebSocket and data interaction method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112486587A true CN112486587A (en) | 2021-03-12 |
Family
ID=74933147
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011314874.6A Pending CN112486587A (en) | 2020-11-20 | 2020-11-20 | Web browser plug-in based on WebSocket and data interaction method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112486587A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103268319A (en) * | 2013-04-17 | 2013-08-28 | 北京航空航天大学 | Cloud browser based on webpages |
CN110430173A (en) * | 2019-07-19 | 2019-11-08 | 河南工程学院 | A kind of cloud platform based on Vue+SpringCloud |
CN111262814A (en) * | 2018-11-30 | 2020-06-09 | 武汉新软科技有限公司 | Information security management system |
-
2020
- 2020-11-20 CN CN202011314874.6A patent/CN112486587A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103268319A (en) * | 2013-04-17 | 2013-08-28 | 北京航空航天大学 | Cloud browser based on webpages |
CN111262814A (en) * | 2018-11-30 | 2020-06-09 | 武汉新软科技有限公司 | Information security management system |
CN110430173A (en) * | 2019-07-19 | 2019-11-08 | 河南工程学院 | A kind of cloud platform based on Vue+SpringCloud |
Non-Patent Citations (2)
Title |
---|
IT_ZILIANG: "Asp.net MVC读取身份证信息支持任何浏览器插件使用WebSocket技术", 《HTTPS://BLOG.CSDN.NET/IT_ZILIANG/ARTICLE/DETAILS/106438687》 * |
JAVA后端: "前后端分离架构:Web 实现前后端分离,前后端解耦", 《HTTPS://BLOG.CSDN.NET/QQ_37217713/ARTICLE/DETAILS/102656272》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107133180B (en) | Dynamic page testing method, testing device and storage medium | |
CN105611330B (en) | Smart television maintenance method and system, server and mobile terminal | |
US20170163753A1 (en) | Method and apparatus for controlling play device to play video | |
CN113687974B (en) | Client log processing method and device and computer equipment | |
US11269705B2 (en) | Method and apparatus for outputting information | |
CN102932370A (en) | Safety scanning method, equipment and system | |
CN111597065B (en) | Method and device for collecting equipment information | |
CN111711533B (en) | Fault diagnosis method, fault diagnosis device, electronic device and storage medium | |
CN113407383B (en) | Main and standby system switching method and device, server and main and standby system | |
CN111246238A (en) | Live broadcast method, device, storage medium and live broadcast system | |
CN112486592A (en) | Distributed data processing method, device, server and readable storage medium | |
CN110881224B (en) | Network long connection method, device, equipment and storage medium | |
US20150205675A1 (en) | Method and System for Improving Reliability of a Background Page | |
US9348999B2 (en) | User terminal, reliability management server, and method and program for preventing unauthorized remote operation | |
CN112699034B (en) | Virtual login user construction method, device, equipment and storage medium | |
CN110592880A (en) | Method and system for timed delay of washing machine in rainy days | |
CN112650674A (en) | Method for remotely acquiring and debugging webpage log, computer equipment and storage medium | |
CN108241616B (en) | Message pushing method and device | |
CN112486587A (en) | Web browser plug-in based on WebSocket and data interaction method | |
CN109446451B (en) | Webpage display method, device, medium and computing equipment | |
CN115065510A (en) | Login method, device, system, electronic equipment and readable storage medium | |
CN112416698B (en) | Expansion method and device of monitoring system, storage medium and electronic equipment | |
CN114553944A (en) | Early warning message pushing method and system | |
CN109446462B (en) | Page-based data monitoring processing method, device, equipment and storage medium | |
CN111737129A (en) | Service control method, service control device, computer readable medium and electronic equipment |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210312 |
|
RJ01 | Rejection of invention patent application after publication |