The correct way to listen on a TCP server in a Chrome extension

I want to create a TCP server and listen to it. I need access to the contents of the tab, so I need the chrome extension. Unfortunately, only chrome applications can create TCP servers.

Is this the right / good concept for creating a TCP server in a chrome application and allows the community to communicate with the extension (is this possible?)?

If not, what will be my alternatives? The only idea I have is to switch from a server model to a client model and allow the extension to connect to an external server. This decision would be bad in my situation, so I try to avoid it as best as possible.

I want to ensure that I can create a chrome extension that modifies / updates content using remote access (nothing malicious). External programs should be able to connect to the extension (or: application) and send their commands to it.

+6
source share
1 answer

Yes, that's a good idea.

1 °) You must create a Chrome App web server (based on https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/webserver , for example, or any other HTTP files)

2 °) Then you should request it on any javascript page through XmlHttpRequest.

+++: No need for Chrome extension. It should work with any modern browser on Windows / Mac / Linux with Chrome 33+ installed.

+1
source

Source: https://habr.com/ru/post/974950/


All Articles